<?php
/* oci_fetch_all example mbritton at verinet dot com (990624) */
$conn = oci_connect("scott", "tiger");
$stmt = oci_parse($conn, "select * from emp");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
if ($nrows > 0) {
echo "<table border=\"1\">\n";
echo "<tr>\n";
while (list($key, $val) = each($results)) {
echo "<th>$key</th>\n";
}
echo "</tr>\n";
for ($i = 0; $i < $nrows; $i++) {
reset($results);
echo "<tr>\n";
while ($column = each($results)) {
$data = $column['value'];
echo "<td>$data[$i]</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
} else {
echo "No data found<br />\n";
}
echo "$nrows Records Selected<br />\n";
oci_free_statement($stmt);
oci_close($conn);
?>