Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

Reply

Join Date: Nov 2009
Posts: 1
Reputation: JackSkylar is an unknown quantity at this point 
Solved Threads: 0
JackSkylar JackSkylar is offline Offline
Newbie Poster

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

 
0
  #1
Nov 11th, 2009
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:

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

I checked if the variables matched, but they seemed to match. Thanks to anyone who helps
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 113
Reputation: Merlin33069 is an unknown quantity at this point 
Solved Threads: 4
Merlin33069 Merlin33069 is offline Offline
Junior Poster
 
-1
  #2
Nov 11th, 2009
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
Do you geek alone?

<<TimmCo>> Custom Computers

~Executive
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #3
Nov 11th, 2009
Originally Posted by JackSkylar View Post
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:

  1. // Connect to database
  2. include_once "scripts/connect_to_mysql.php";
  3. $emailCHecker = mysql_real_escape_string($email1);
  4. $usernameChecker = mysql_real_escape_string($username);
  5. $emailCHecker = eregi_replace("`", "", $emailCHecker);
  6. $usernameChecker = eregi_replace("`", " ", $usernameChecker);
  7. // Database duplicate e-mail check setup for use below in the error handling if else conditionals
  8. $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
  9. $email_check = mysql_num_rows($sql_email_check);
  10. $sql_username_check = mysql_query("SELECT username FROM myMemebers WHERE username='$usernameChecker'");
  11. $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-
  1. $emailCHecker = eregi_replace("`", "", $emailCHecker);
The proper way to handle the num_rows -
  1. $email_check = 0;
  2. if(mysql_num_rows($sql_email_check) !='' || mysql_num_rows($sql_email_check) !=FALSE)
  3. {
  4. $email_check = mysql_num_rows($sql_email_check); }
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,430
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 232
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey
 
0
  #4
Nov 11th, 2009
Don't use ereg (http://php.net/preg), and read the giant READ ME FAQ at the top of the PHP forums then come back here and ask your question again
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 373 | Replies: 3
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC