pg_fetch_object

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shantanu
Forum Newbie
Posts: 8
Joined: Wed Apr 02, 2003 11:15 pm

pg_fetch_object

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply