best way to get COUNT from result set
| From: | Christian Dechery | Date: | Wed, 20 Dec 2000 00:26:42 +0000 |
| Subject: | best way to get COUNT from result set | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31107@lists.php.net to get a copy of this message | ||
there's no way to get a single result from a query (since several functions like MAX(), AVG(), COUNT(), ...) return single values...
I could go like...
$q = "select count(id) from table";
$rslt = mysql_query($q);
$count = mysql_fetch_row($rslt);
and then $count[0] would have what I want...
but this is kinda "syntax ugly"... I only want ONE value... I don't want an ARRAY...
of course $count = $count[0] (I'm sure a lot of people would sugest that) is possible, but is also "syntax ugly"...
is there any way around this?
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer