Page 1 of 1

pg_fetch_object

Posted: Mon Apr 07, 2003 8:31 am
by Shantanu
dear all.
need ur help again!!

I'm using pg_fetch_object() function with postgres function for displaying some records on the html page.
Take a look at the foll. code

Code: Select all

...
..
$result=pg_query($connection,"select * from Table");
while( $res=pg_fetch_object($result,$row))
{
   echo $res->author;
   $row++;
}

The code works fine(doesn't give any error) but doesn't print any value .
However it enters the while loop as many times as the number od records fetched in the query.

Thx. in advance....

Shantanu

Posted: Mon Apr 07, 2003 8:46 am
by volka
maybe there is no field author?
try

Code: Select all

$result=pg_query($connection,"select * from Table");
echo '<pre>';
while( $res=pg_fetch_object($result,$row))
{
   print_r($res);
   $row++;
}
echo '</pre>';
field/property names are case-sensitive.