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/