I have a simple mysql query checking the database table 'all_users' for an e-mail which was entered in a text field.
The e-mail is in a variable called $email
.
In my test case, $email
is [email protected] and that e-mail exists in the database table.
When I do this:
$result=mysql_query("select * from all_users where email='$email' ") or die (mysql_error());
$row=mysql_fetch_array($result);
$num=mysql_num_rows($result);
$num
is zero even though $row
is found.
So when I do echo $row['email'];
it correctly prints out '[email protected]' but when I do echo $num;
it's 0!
What am I doing wrong here? I've done this a thousand times but never had this issue.
select * from all_users
and update us with the result , please. – Ofir Baruch Mar 7 '12 at 11:47