On 21-Mar-01 Mike Gifford wrote:
> Hi David,
>
> I counted the number of rows using mysql_numrows(), but I've been told that
> count() is way faster. Unfortunately, I can't seem to get count working..
> Any
> ideas?
>
> <?php
> echo mysql_numrows(mysql_query("select * FROM phPetition",$db));
>
> // This should be faster, but doesn't seem to work
> // echo count(mysql_query("select * FROM phPetition",$db));
> ?>
>
;)
$result= mysql_query("select count(*) as cnt FROM phPetition",$db));
if ($result) {
$row = mysql_fetch_object($result);
echo 'count: ', $row->cnt, '<br>';
}
Regards,
--
Don Read [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy.
God will forgive you but the bureaucrats won't.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]