pg_fetch_result1.htm
Code : pg_fetch_result1.txt
$rows = pg_num_rows($result);
$fields = pg_num_fields($result);
echo "No of rows/records :". $rows."<br/>";
echo "No of fields :". $fields."<br/>";
//
// pg_fetch_result(query-object, row, column-field
for($i=0; $i< $rows; $i++){
$val1 = pg_fetch_result($result, $i, 0);
$val2 = pg_fetch_result($result, $i,2 );
echo "row ". $i. " 2nd field : ".$val1." || "."3rd field : ".$val2."<br/>";
}
echo "iterating with embedded loops <br/> ";

for($x=0; $x < 4; $x++)
{

for($y=0; $y < 5 ; $y++)
{
//echo " column :". $y ;
$r2 = pg_fetch_result($result, $x, $y);
$r3 = pg_field_name($result, $y);
echo $r3 ." = ".$r2.":";
}
echo "||<br/>";
}