Re: mysql_num_rows error
| From: | Tom Rogers | Date: | Mon, 23 Sep 2002 06:24:35 +0000 |
| Subject: | Re: mysql_num_rows error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117243@lists.php.net to get a copy of this message | ||
Hi,
Sunday, September 23, 2001, 3:25:02 PM, you wrote:
NV> I am new to php and that the folowing error: Warning: mysql_num_rows():
NV> supplied argument is not a valid MySQL result resource in
NV> /home/tbonestu/public_html/smallimages.php
NV> i dont know what i am doing wrong here is the code:
NV> @ $db = mysql_pconnect(connect info);
NV> mysql_select_db("images");
NV> $query = "select * from images where type =".$type."";
NV> $result = mysql_query($query);
NV> $num_results = mysql_num_rows($result);
Do it this way
$query = "select * from images where type = '$type'";
or if you prefer
$query = "select * from images where type = '".$type."'";
PS check your comps date its a year out
--
regards,
Tom