dbconnect();
$q = oci_parse($dbo->db, "select * from employees");
$r = oci_execute($q, OCI_DEFAULT);
print "Return $r\n";
$ncols = oci_num_fields($q);
for ($i = 1; $i <= $ncols; $i++) {
$column_name = oci_field_name($q, $i);
$trow[] = $column_name;
}
$table[] = $trow;
while ($row = oci_fetch_array($q, OCI_ASSOC+OCI_RETURN_NULLS)) {
$table[] = $row;
}
$dbo->print_table($table);
?>
db = oci_connect('hr', 'hr', 'orcl');
}
function print_table($table) {
print "\n";
foreach ($table as $row) {
print "";
foreach ($row as $cell) {
if (!isset($cell)) {$cell = 'n/a'; }
print " $cell | ";
}
print "
\n";
}
print "
\n";
}
}
?>
db) {print "Problem\n"; exit;}
}
}
?>