Re: pg_fetch_array() - Mailing list pgsql-php

From scott.marlowe
Subject Re: pg_fetch_array()
Date
Msg-id Pine.LNX.4.33.0212181455320.4045-100000@css120.ihs.com
Whole thread Raw
In response to pg_fetch_array()  (Thorsten Haude <postgresql@thorstenhau.de>)
List 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 - - -

Wrap your while loop in this test:

if (pg_num_rows($result)>0){

}


It may be you're not getting any rows back here.



pgsql-php by date:

Previous
From: "joerg.niemann"
Date:
Subject: Re: pg_fetch_array()
Next
From: Thorsten Haude
Date:
Subject: Re: pg_fetch_array()