Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8B3F4476DAA for ; Wed, 18 Dec 2002 17:09:20 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id C47F5476CCD for ; Wed, 18 Dec 2002 16:55:22 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gBILtFJb009591; Wed, 18 Dec 2002 14:55:15 -0700 (MST) Date: Wed, 18 Dec 2002 14:56:56 -0700 (MST) From: "scott.marlowe" To: Thorsten Haude Cc: PostgreSQL PHP ML Subject: Re: pg_fetch_array() In-Reply-To: <20021218203832.GI1604@eumel.yoo.local> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/42 X-Sequence-Number: 1717 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 - - - Wrap your while loop in this test: if (pg_num_rows($result)>0){ } It may be you're not getting any rows back here.