Re: Select count

Поиск
Список
Период
Сортировка
От Stephen van Egmond
Тема Re: Select count
Дата
Msg-id 20001106095151.G19976@bang.dhs.org
обсуждение исходный текст
Ответ на Select count  (Aguinaldo Fagundes Junior <Aguinaldo.Fagundes@vantcom.net>)
Список 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/



В списке pgsql-php по дате отправления:

Предыдущее
От: Aguinaldo Fagundes Junior
Дата:
Сообщение: Select count
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: [SQL] FTI, paged, ranked searching and efficiency.