From: | "joerg(dot)niemann" <joerg(dot)niemann(at)cityweb(dot)de> |
---|---|
To: | postgresql(at)thorstenhau(dot)de |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: pg_fetch_array() |
Date: | 2002-12-18 21:36:12 |
Message-ID: | 200212182136.WAA27213@cweb53.intern.cityweb.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Philipp Ottlinger | 2002-12-18 21:44:09 | Re: pg_fetch_array() |
Previous Message | Harry Waddell | 2002-12-18 21:12:28 | Re: pg_fetch_array() |