RE: [PHP] mysql_num_rows error
| From: | John Holmes | Date: | Mon, 23 Sep 2002 11:00:52 +0000 |
| Subject: | RE: [PHP] mysql_num_rows error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117255@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.
---John Holmes...