Skip to main content
Known Participant
November 14, 2010
Answered

mysql_num_rows() warning

  • November 14, 2010
  • 2 replies
  • 4278 views

I am getting these warnings on one of my pages:

Warning:  mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\WFRMA\Admin\update.php on line 126

Warning:  mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\WFRMA\Admin\update.php on line 147

I commented out the lines to see if they are in fact where the problem lies. I didn't receive the errors after doing this so the line references appear to be accurate. I've been unable to figure out how to fix this though. The script seems to run just fine even with this warning, but I would like to correct whatever is happening and grateful for any help getting me on the right track.

Local server: XAMPP version 2.5.8

PHP 5.3.1

MySQL 5.1.41

phpMyAdmin 3.2.4

Apache 2.2.14

Workstation OS: Win XP Pro SP3

This topic has been closed for replies.
Correct answer David_Powers

Marking thread as "assumed answered".

2 replies

David_Powers
David_PowersCorrect answer
Inspiring
November 18, 2010

Marking thread as "assumed answered".

November 14, 2010

I dont know how anyone would be able to tell without seeing lines 126 and 147.

Gary

bmmotionAuthor
Known Participant
November 15, 2010

These are the two lines in question:

#126:    $totalRows_rsUsers = mysql_num_rows($all_rsUsers);

#147:   $totalRows_rsDirectory = mysql_num_rows($all_rsDirectory);

November 15, 2010

I'm sorry, I should have said to post all of your code, however, that type of error is sometimes the result of MySQL being unable to process the SQL  you provided it, so you need to check the query code. Check to see if  the result of your mysql_query() is false, and if so, do an error_log()  or otherwise output the query string and the result of mysql_error() to  find out what was wrong with the query.

If that does not work, post all of your code.

Gary