<html><head>
<title>:: arul's PHP script to display data from a table stored in oracle :: arul john ::</title>
</head>
<body>
<h2>contents of the table</h2>
<?
$username = "myName";
$password = "myPassword";
if (!($conn = ora_logon($username, $password))) {
echo "failed!!";
exit;
}
$cursor = ora_open($conn);
$query = "select * from person";
$cursor = ora_open($conn);
ora_parse($cursor, $query, 0);
ora_exec($cursor);
$numCols = ora_numcols($cursor);
?>
<table>
<tr>
<?
for ($i = 0; $i < $numCols; $i++) {
echo "<td>";
echo ora_columnname($cursor, $i);
echo "</td>";
}
while (ora_fetch($cursor)) {
echo "<tr>";
for ($i = 0; $i < $numCols; $i++) {
echo "<td>";
echo ora_getcolumn($cursor, $i);
echo "</td>";
}
echo "</tr>";
}
?>
</table>
</body>
</html>
syntax highlighted by Code2HTML, v. 0.9.1