MySQL Forums
Forum List  »  PHP

Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
Posted by: swapshop swapshop
Date: August 22, 2005 01:38PM

We have a issue with a php/mysql script that have not been modified and has been running for months with out a issue.

One db, with quite a few tables.

To generate a page we use this one db and what eva tables needed and 99.9% work except we get

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

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/site/public_html/classifieds/detail.php on line xxx
No comments.

Section of the code

$sql_comments = "SELECT * FROM $com_tbl where comsiteid=$siteid";
$res_comments = mysql_query($sql_comments);
$num_comments = mysql_num_rows($res_comments); <------issue here
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
for ($i=0; $i<$num_comments; $i++)

We have tried this code as well

if ($row = mysql_num_rows($res_comments)) {
return $row;
} else {
print (mysql_error());
}

This produces

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sitename/public_html/classifieds/detailtestcomments.php on line 861
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where comsiteid=943' at line 1


Any ideas as our code has not change, Host tells us no upgrades either??????

Options: ReplyQuote


Subject
Written By
Posted
Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
August 22, 2005 01:38PM
August 10, 2005 10:15PM
October 26, 2005 04:35PM
October 26, 2005 04:38PM
January 14, 2006 03:43AM
September 08, 2005 02:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.