gizmorattler Posted December 26, 2009 Share Posted December 26, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/186364-warning-mysql_num_rows-expects-parameter-1-to-be-resource/ Share on other sites More sharing options...
cags Posted December 26, 2009 Share Posted December 26, 2009 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); Quote Link to comment https://forums.phpfreaks.com/topic/186364-warning-mysql_num_rows-expects-parameter-1-to-be-resource/#findComment-984184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.