Re: pg_fetch_array()

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: pg_fetch_array()
Дата
Msg-id Pine.LNX.4.33.0212181501190.4045-100000@css120.ihs.com
обсуждение исходный текст
Ответ на pg_fetch_array()  (Thorsten Haude <postgresql@thorstenhau.de>)
Список pgsql-php
On Wed, 18 Dec 2002, Thorsten Haude wrote:

> Hi,
>
> I want to read an unknown number of rows from a select result. I try
> this:
> - - - Schnipp - - -
> $result = pg_exec($dbh, $statement);
> $row = 0;
> while ($item = pg_fetch_array($result, $row, PGSQL_ASSOC))
> {
>     doSomething($item);
>     $row++;
> }
> - - - Schnapp - - -
>
> However, I get an error telling me that PHP is "Unable to jump to row
> [$nRows + 1] on PostgreSQL result index 3 in [$file] on line [$line]

Sorry for the previously not quite right response.  Since you are passing
in PGSQL_ASSOC you have to supply a row number, do it like this:

$stop = pg_num_rows($result);
for ($i=0;$i<$stop;$i++){
 doSomething($item);
}


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

Предыдущее
От: Thorsten Haude
Дата:
Сообщение: Re: pg_fetch_array()
Следующее
От: Mark Nelson
Дата:
Сообщение: getting table names