scott_pgsql_employee.htm
 
Intranet Users:

http://manas9/BareBone_Oracle/m9w8/postgresql_doc/PGSQL_DBMS_Employee/scott_pgsql_employee.php

Script Used:

<html>
<head>
<title> scott_pgsql_employee.php</title>
</head>
<body>
Oracle like PostgreSQL employee Table <br/>
Uses pg_fetch_row($result) <br/>
<?php
// database access parameters
// alter this as per your configuration
$host = "localhost";
$user = "username";
$pass = "password";
$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";
exit;
}

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

Results: