RE: [PHP-DB] not a valid MySQL result resource
| From: | John W. Holmes | Date: | Tue, 21 Jan 2003 02:00:23 +0000 |
| Subject: | RE: [PHP-DB] not a valid MySQL result resource | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24994@lists.php.net to get a copy of this message | ||
When you get that error, it generally means your query failed, or you
have the wrong variable in a mysql_fetch_*() function. Use mysql_error()
to see what the error is if the query failed.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: Addison Ellis [mailto:addison@bellsouth.net]
> Sent: Monday, January 20, 2003 2:30 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] not a valid MySQL result resource
>
> hello and thank you for your time.
> can you tell me why the below: i think this whole section is
> line 22 because whatever i change in these first four lines still has
> the error message point to line 22.
> $cobj = mysql_db_query($dbname,"select * from category where
> id=$category"); //line 22
> $crow = mysql_fetch_object($cobj);
> $scobj = mysql_db_query($dbname,"select * from subcategory where
> category=$category");
> $scrow = mysql_fetch_object($scobj);
>
> <? echo $crow->name;?>
> <? echo $scrow->name;?>
>
> gives me this:
> Warning: Supplied argument is not a valid MySQL result resource in
> /users/infoserv/web/register/ca/direct.php on line 22
>
>
> perhaps i should use something different. i am trying to print the
> results from two previous selections on this third page. the second
> page works with
> $cobj = mysql_db_query($dbname,"select * from category where
> id=$category");
> $crow = mysql_fetch_object($cobj);
> <? echo $crow->name;?>
>
> and then they make selection two...
> thank you again. addison
> --
> Addison Ellis
> small independent publishing co.
> 114 B 29th Avenue North
> Nashville, TN 37203
> (615) 321-1791
> addison@bellsouth.net
> info@smipco.com
> subsidiaries of small independent publishing co.
> info@gloabaldog.com
> info@momandpocentral.com