$sql";
echo "";
foreach ( $cols as $index => $col ) {
echo "$col | ";
}
echo "
\n";
$db = pg_connect("host=localhost dbname=xwgames user=postgres password=$pwd");
if (!$db) {
die( "Error in connection: " . pg_last_error() );
}
// execute query
$result = pg_query($db, $sql);
if (!$result) {
die( "Error in SQL query: " . pg_last_error() );
}
// iterate over result set
// print each row
while ( $row = pg_fetch_array($result) ) {
echo "";
foreach ( $cols as $index => $col ) {
echo "" . "$row[$index]" . " | ";
}
echo "
\n";
}
/* cleanup */
pg_free_result( $result );
pg_close( $db );
?>