Page 1 of 1

Wrong parameter count for pg_fetch_object()

Posted: Thu Feb 19, 2004 10:27 am
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

Posted: Thu Feb 19, 2004 10:32 am
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.

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

Posted: Thu Feb 19, 2004 10:41 am
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

Posted: Thu Feb 19, 2004 10:42 am
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