row, or FALSE when no rows remain. Compare this function to pg_fetch_array and
pg_fetch_row.
<?
//connect to database
if(!($Connection = pg_connect("", "", "", "", "leon")))
{
print("Could not establish connection.
\n");
exit;
}
//create query
$Query = "SELECT * ";
$Query .= "FROM item";
//execute query
if(!($Result = pg_exec($Connection, $Query)))
{
print("Could not execute query: ");
print(pg_errormessage($Connection));
print("
\n");
exit;
}
//loop over each row
while($Row = pg_fetch_object($Result, $Row))
{
print("$Row->Name
\n");
}
// free the result and close the connection
pg_freeresult($Result);
pg_close($Connection);
?>
array pg_fetch_row(integer result, integer row)
The pg_fetch_row function returns the values of all the fields in a row. The fields may
are indexed by their field number, starting with zero. Each call to pg_fetch_object
returns the next row, or FALSE when no rows remain. Compare this function to
pg_fetch_array, and pg_fetch_object.
<?
//connect to database
if(!($Connection = pg_connect("", "", "", "", "leon")))
{
print("Could not establish connection.
\n");
exit;
}