If I understand you correctly, you need to loop across the recordset. You can do something along the lines of:
for($i=0;$i<count($result);$i++){
print "<tr>";
print "<td>".pg_result($result,$i,"fieldname")."</td>";
print "<td>".pg_result($result,$i,"fieldname2")."</td>";
print "</tr>"
}
Hope this helps
Darren