RE: [PHP] mysql_num_rows error

From: Date: Mon, 23 Sep 2002 13:03:50 +0000
Subject: RE: [PHP] mysql_num_rows error
Groups: php.general 
Request: Send a blank email to php-general+get-117267@lists.php.net to get a copy of this message
>> I am new to php and that the folowing error: Warning: mysql_num_rows(): >> supplied argument is not a valid MySQL result resource in >> /home/tbonestu/public_html/smallimages.php >> >> i dont know what i am doing wrong here is the code: >> >> @ $db = mysql_pconnect(connect info); >> >> mysql_select_db("images"); >> $query = "select * from images where type =".$type.""; $result = >> mysql_query($query); $num_results = mysql_num_rows($result); >That generally means your query failed. Try to echo mysql_error() after your query to see what the problem is. You probably need quotes around $type or $type has no value. You also have too many quotes on the $query line, try echoing your $query variable to see if it reads properly. Mark

« previous php.general (#117267) next »