pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: Select count
2+ messages / 2 participants
[nested] [flat]

* Select count
@ 2000-11-06 15:38 Aguinaldo Fagundes Junior <Aguinaldo.Fagundes@vantcom.net>
  2000-11-06 14:51 ` Re: Select count Stephen van Egmond <svanegmond@bang.dhs.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Aguinaldo Fagundes Junior @ 2000-11-06 15:38 UTC (permalink / raw)
  To: pgsql-php

Hi there!

I could not find in documentation, how I can get the result from a query
using select "count(*)". Today I use a "select * " and after using
pg_numrows and it woks but I want to know:Is there any other way to get this
result?

Thanks in advance.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Select count
  2000-11-06 15:38 Select count Aguinaldo Fagundes Junior <Aguinaldo.Fagundes@vantcom.net>
@ 2000-11-06 14:51 ` Stephen van Egmond <svanegmond@bang.dhs.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephen van Egmond @ 2000-11-06 14:51 UTC (permalink / raw)
  To: Aguinaldo Fagundes Junior <Aguinaldo.Fagundes@vantcom.net>; +Cc: pgsql-php

Aguinaldo Fagundes Junior (Aguinaldo.Fagundes@vantcom.net) wrote:

> Hi there!
> 
> I could not find in documentation, how I can get the result from a query
> using select "count(*)". Today I use a "select * " and after using
> pg_numrows and it woks but I want to know:Is there any other way to get this
> result?

$result = pg_exec($conn, "SELECT count(*) blah blah blah");
$count = pg_result($result, 0, 0);

That gets the first variable from the first row, fast.  If you're using
fetcharray, you can also use the name 'count' I think, or if that
doesn't work, label it with "SELECT count(*) as foo" and ask for foo.


-- 
       ,,,
      (. .)
+--ooO-(_)-Ooo------------ --- -- - - -  -
| Stephen van Egmond  http://bang.dhs.org/





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-11-06 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-06 15:38 Select count Aguinaldo Fagundes Junior <Aguinaldo.Fagundes@vantcom.net>
2000-11-06 14:51 ` Stephen van Egmond <svanegmond@bang.dhs.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox