Jump to content

Warning: mysql_num_rows() expects parameter 1 to be resource


gizmorattler

Recommended Posts

I'm trying to connect to my localhost to test this Join Form parse out. I have the email checker code here but when I submit the form it echos an error message in the browser saying:

 

"Warning: mysql_num_rows() expects parameter 1 to be resource"

 

Here's the code:

$emailCHecker = mysql_real_escape_string($email1);

$sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");

$email_check = mysql_num_rows($sql_email_check); 

if ($email_check > 0){ 

$errorMsg = "<u>ERROR:</u><br />

Your Email address is already in use inside our system. Please use another.";

 

What am I missing?

You generally get such an error message when your call to mysql_query fails (as it will return a boolean FALSE, which when passed to mysql_num_rows is not what it's expecting). You need to add some error trapping to find out why it's failing as nothing jumps out at me.

 

$sql = "SELECT email FROM myMembers WHERE email='$emailCHecker'";
$sql_email_check = mysql_query($sql) or trigger_error("SQL: $sql, Error: " . mysql_error(), E_USER_ERROR); 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.