<?php
/* Connect to database with persistent connection (maintained
for the duration of the Apache process.
Persistent connections are not possible with CGI.
*/
$conn = my_connect("host=db.company.com user=my_name
password=my_passwd dbname=my_db");
if (!$conn) {
echo "Error.\n";
exit;
}
$sql="SELECT * FROM my_table;";
$result_set = my_exec ($conn, $sql);
$rows = my_numrows($result_set);
if ((!$result_set) || ($rows < 1)) {
echo "<H1>ERROR - no rows returned</H1><P>";
exit;
}
for ($j=0; $j < $rows; $j++) {
echo my_result($result_set, $j, "column_name");
}
?>