Code : scott_pgsql_employee.php

<title> scott_pgsql_employee.php</title>
Oracle like PostgreSQL employee Table <br/>
Uses pg_fetch_row($result) <br/>
// database access parameters
// alter this as per your configuration
$host = "localhost";
$user = "postgres";
$pass = "postgre_manas9";
$db = "pgsdemo1";
// open a connection to the database server
$dbconn = pg_connect ("host=$host dbname=$db user=$user password=$pass");
if (!$dbconn)
die("Could not open connection to database server");
echo "connection successful <br/>";

$result = pg_query($dbconn, "SELECT * FROM emp ORDER BY ename");
if (!$result) {
echo "An error occured.\n";

while ($row = pg_fetch_row($result)) {
echo "id: $row[0] ename: $row[1]";
echo "<br />\n";