<head>
<title>Simple Demo</title>
</head>
<body>
<p>
A simple row dump of columns col1, col2 and col3 of "yourtable" order by col1:
</p>
<table border="0"><tbody>
<tr><th><u>Col1</u></th><th><u>Col2</u></th><th><u>Col3</u></th></tr>
<?php
putenv("ORACLE_HOME=/path/to/your/oracle/home/directory");
putenv("TWO_TASK=yourdatabaseservicename");
$conn = OCILogon("yourusername", "yourpassword","yourdatabaseservicename");
$query = "SELECT col1, col2, col3 FROM yourtable ORDER BY col1";
$stmt = OCIParse($conn, $query);
$result = OCIExecute($stmt);
if ($result) // Was the execute successful?
{
//OCIFetchInto($stmt, &$columns, OCI_ASSOC+OCI_RETURN_NULLS)
//returns associative array $columns["COL1"], $columns["COL2"], etc.
//Without the OCI_ASSOC use $columns[0] for COL1, $columns[1] for COL2, etc.
while (OCIFetchInto($stmt, &$columns, OCI_ASSOC+OCI_RETURN_NULLS))
{
print "<tr><td>{$columns["COL1"]}</td><td>{$columns["COL2"]}</td><td>{$columns["COL3"]}</td></tr>\n";
}
}
else
{
print '<tr><td colspan="3" align="CENTER">No rows returned</td></tr>'."\n";
}
OCILogoff($conn);
?>
</tbody></table>
</body>
-- Michael
Darkstreak Consulting
www.darkstreak.com