Wrong parameter count for 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
mccommunity
Forum Commoner
Posts: 62
Joined: Mon Oct 07, 2002 8:55 am

Wrong parameter count for pg_fetch_object()

Post by mccommunity »

I am trying to run a query and spit out the variables, I am getting an error anyone know what I am doing wrong?


Code: Select all

$query = "select * from data_inventory where auction_event='$event'";
$result = pg_exec($con,$query);

$num = pg_numrows($result); 


if($num > 0){ 
while($rows = pg_fetch_object($result)) 
   {

echo $rowsї0];
echo $rowsї1];
echo $rowsї2];
}else{
echo 'no records found';
}


I am getting the following error and line 19 is the while line: Warning: Wrong parameter count for pg_fetch_object() in /home/ams/public_html/test/xml/index.php on line 19
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Are you using PHP => 4.1.0 ?
The row option to pg_fetch_object() is only optional on 4.1.0 or above.
mccommunity
Forum Commoner
Posts: 62
Joined: Mon Oct 07, 2002 8:55 am

Warning: Wrong parameter count for pg_fetch_row() in /home/a

Post by mccommunity »

I am using an older version of php and so I changed it to pg_fetch_row and it now is saying: Warning: Wrong parameter count for pg_fetch_row() in /home/ams/public_html/test/xml/index.php on line 19
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Again, if you on an older version of PHP than 4.1.0 then the row parameter is not optional. See the manual pages..

*Note: From 4.1.0, row became optional.* http://php.net/pg_fetch_row
Post Reply