Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7B28E476A0B for ; Wed, 18 Dec 2002 16:50:56 -0500 (EST) Received: from cweb53.intern.cityweb.de (unknown [193.101.111.49]) by postgresql.org (Postfix) with ESMTP id 7E2E4476CF3 for ; Wed, 18 Dec 2002 16:36:11 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by cweb53.intern.cityweb.de (8.9.3+Sun/8.9.3) with SMTP id WAA27213; Wed, 18 Dec 2002 22:36:12 +0100 (MET) Date: Wed, 18 Dec 2002 22:36:12 +0100 (MET) Message-Id: <200212182136.WAA27213@cweb53.intern.cityweb.de> Subject: Re: pg_fetch_array() To: postgresql@thorstenhau.de From: "joerg.niemann" Cc: pgsql-php@postgresql.org X-Mailer: cityweb-Mailmanager based on postaci X-Comment: This message was sent from 217.82.1.212 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/41 X-Sequence-Number: 1716 Thorsten Haude wrote: >Hi, > >I want to read an unknown number of rows from a select result. I try >this: >- - - Schnipp - - - >$result =3D pg_exec($dbh, $statement); >$row =3D 0; >while ($item =3D 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=3D0; $i < pg_num_rows($result); $i++) Joerg --=20 =20 --------------------------------------- http://www.cityweb.de