No matter what I do I always get "Wrong Username or Password" Already tried different types of solutions but none helped.
//header('Access-Control-Allow-Origin: *');
include('db.php');
// username and password sent from form
$myusername=$_POST['username'];
$mypassword=$_POST['password'];
// To protect MySQL injection
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
echo '{"type":"1",'.
'"item": "Logged In"'.
'}';
}
else {
echo '{"type": "0",'.
'"item":"Wrong Username or Password"'.
'}';
}
Can anyone help please? Thank you in advanced!