print("
\n");
//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;
}
// print each row in a table
print("
\n");
// print header row
print("
\n");
for($Field=0; $Field pg_numfields($Result); $Field++)
{
print("
");
print(pg_fieldname($Result, $Field). " ");
print(pg_fieldtype($Result, $Field));
print("(". pg_fieldsize($Result, $Field). ")");
print(" | \n");
}
print("/TR>\n");
//loop through rows
for($Row=0; $Row pg_numrows($Result); $Row++)
{
print("
\n");
for($Field=0; $Field pg_numfields($Result); $Field++)
{
print("");
if(pg_fieldisnull($Result, $Row, $Field))
{
$price = "NULL";
}
else
{
print(pg_result($Result, $Row, $Field));
}
print(" | \n");
}
print("
\n");
}
print("/TABLE>\n");