Re: pg_fetch_array()

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Thorsten Haude <postgresql(at)thorstenhau(dot)de>
Cc: PostgreSQL PHP ML <pgsql-php(at)postgresql(dot)org>
Subject: Re: pg_fetch_array()
Date: 2002-12-18 21:56:56
Message-ID: Pine.LNX.4.33.0212181455320.4045-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Thorsten Haude 2002-12-18 22:03:29 Re: pg_fetch_array()
Previous Message Philipp Ottlinger 2002-12-18 21:44:09 Re: pg_fetch_array()