From: joerg.niemann <joerg.niemann@cityweb.de>
To: postgresql@thorstenhau.de
Cc: pgsql-php@postgresql.org
Subject: Re: pg_fetch_array()
Date: Wed, 18 Dec 2002 22:36:12 +0100 (MET)
Message-ID: <200212182136.WAA27213@cweb53.intern.cityweb.de> (raw)
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]
This is a warning.
The warning occurence is the exit signal for the while statement.
If inside the while statement php is unable to jump to row x it
is the signal to exit the while statement.
Use pg_num_rows and for to avoid this.
for ($i=0; $i < pg_num_rows($result); $i++)
Joerg
--
---------------------------------------
http://www.cityweb.de
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: joerg.niemann@cityweb.de, postgresql@thorstenhau.de
Subject: Re: pg_fetch_array()
In-Reply-To: <200212182136.WAA27213@cweb53.intern.cityweb.de>
References: <200212182136.WAA27213@cweb53.intern.cityweb.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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