[RESOLVED] MySQL: What's wrong with this query?
Hi there.
I have a problem getting the following code to work:
PHP Code:
// username and password sent from form
$email=$_POST['email'];
$mobile=$_POST['mobile'];
// To protect MySQL injection
$email = stripslashes($email);
$mobile = stripslashes($mobile);
$email = mysql_real_escape_string($email);
$mobile = mysql_real_escape_string($mobile);
$result=mysql_query("SELECT * FROM users WHERE email==$email AND mobile==$mobile");
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If $result matched $email and $mobile, table row must be 1 row
if($count==1){
// Register $email, $mobile and redirect to file "myTTX.php"
//session_register['email'];
$_SESSION['email']=$email;
//session_register['mobile'];
$_SESSION['mobile']=$mobile;
header("location:myTTX.php");
}
else {
echo"Wrong Username or Password";
}
?>
Currently, I get an error message "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource".
Can anyone point me in the right direction?