Re: pg_fetch_array()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.




[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux