Re: Resource id #2 ?

From: Date: Fri, 18 Jan 2002 17:15:23 +0000
Subject: Re: Resource id #2 ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15970@lists.php.net to get a copy of this message
You have to fetch the row that contains the count in it. Try this: $resource = mysql_query("SELECT COUNT(*) cnt FROM catalogs WHERE PROCESSED IS NULL"); $countreq = mysql_fetch_array($resource); echo $countreq[cnt]; (note as well that if no row is returned by the query then $countreq will be set to false, so checking that before using it as an array is a good idea) - Patrick ----- Original Message ----- From: "James Kupernik" <kupernik@bcn.net> To: <php-db@lists.php.net> Sent: Friday, January 18, 2002 12:05 PM Subject: [PHP-DB] Resource id #2 ? > I run this query $countreq = mysql_query("SELECT COUNT(*) FROM catalogs > WHERE PROCESSED IS NULL"); then try to echo $countreq but end up getting > Resource id #2 instead of the count total. What would cause this? > > Thanks for any advise! > > James > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#15970) next »