Re: [PHPLIB] count(*) on select From: Chia-liang Kao (clkao <email protected>)
Date: 11/19/99

On Fri, Nov 19, 1999 at 10:27:04AM +0100, Fabrizio Ermini wrote:
> $db->query("select count(*) as numrecord from table where one='two'");
> printf ("The number of record contained in table is: %d", $db-
> >f("numrecord"));
>
> And the other way is
>
> $db->query("select * from table where one='two'");
> printf ("The number of record contained in table is: %d", $db->nf());

I guess this would cause your sql server to prepare for the upcoming
fetch_rows it expects, which may make the server to work more than it should.

So if you just want to count the numbers, just use count(*) and use an `as'
to override the field name.

Cheers,
CLK
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.