Jump to content

Warning: mysql_num_rows() expects parameter 1 to be resource


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); 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.