0

I keep getting this message

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/j/a/c/jackattacksite/html/register.php on line 80

Here's the code:

// Connect to database
     include_once "scripts/connect_to_mysql.php";
     $emailCHecker = mysql_real_escape_string($email1);
	 $usernameChecker = mysql_real_escape_string($username);
	 $emailCHecker = eregi_replace("`", "", $emailCHecker);
	 $usernameChecker = eregi_replace("`", " ", $usernameChecker);
     // Database duplicate e-mail check setup for use below in the error handling if else conditionals
     $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
     $email_check = mysql_num_rows($sql_email_check); 
	 $sql_username_check = mysql_query("SELECT username FROM myMemebers WHERE username='$usernameChecker'");
	 $username_check = mysql_num_rows($sql_username_check);

I checked if the variables matched, but they seemed to match. Thanks to anyone who helps

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by ShawnCplus
-1

i believe this generally means that the search of the database is not returning any result... or something along those lines...

you could try adding a catch after the mysql_query's

something like

$sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'") OR die('Error in mysql syntax: ' . mysql_error());

but gl getting this fixed

0

I keep getting this message

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/j/a/c/jackattacksite/html/register.php on line 80

Here's the code:

// Connect to database
     include_once "scripts/connect_to_mysql.php";
     $emailCHecker = mysql_real_escape_string($email1);
	 $usernameChecker = mysql_real_escape_string($username);
	 $emailCHecker = eregi_replace("`", "", $emailCHecker);
	 $usernameChecker = eregi_replace("`", " ", $usernameChecker);
     // Database duplicate e-mail check setup for use below in the error handling if else conditionals
     $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
     $email_check = mysql_num_rows($sql_email_check); 
	 $sql_username_check = mysql_query("SELECT username FROM myMemebers WHERE username='$usernameChecker'");
	 $username_check = mysql_num_rows($sql_username_check);

I checked if the variables matched, but they seemed to match. Thanks to anyone who helps

are you sure you want to do this way-

$emailCHecker = eregi_replace("`", "", $emailCHecker);

The proper way to handle the num_rows -

$email_check = 0;
if(mysql_num_rows($sql_email_check) !='' || mysql_num_rows($sql_email_check) !=FALSE)
{
$email_check = mysql_num_rows($sql_email_check); }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.