Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
I am working on a registration form which corresponds with two mysql tables in my database.
- userlogin – contains all the details registered with the site
- userlogin_fb – contains all the details of users using the fb connect facility
Now when a user signs up there cannot be a clash of username or email address. I am now implementing the validation code for checking the email addresses across the two tables (which will be used as a reference for the username validation):
But i keep receiving the following error message:
Warning: mysql_num_rows() expects
parameter 1 to be resource, boolean
given in register.php on line 144
How do i go about resolving this?
//select all rows from our users table where the emails match
$res1 = mysql_query("SELECT * FROM `userloginl.email`,`userlogin_fb.email` WHERE `email` = '".$email."'");
$num1 = mysql_num_rows($res1);
//if the number of matchs is 1
if($num1 == 1){
//the email address supplied is taken so display error message
echo "<center>The <b>e-mail</b> address you supplied is already taken</center>";
include_once ("resources/php/footer.php");
exit;
}else{
//finally, otherwise register there account }
Any help would be appreciated – thanks!
check if your query is correct or not and then count the rows.
in your case the script will
die(). check what was causing it to die and fix it. in general you must always check if your queries returnedtrueorfalseand then work on them