Hi Guys,
Could someone point me to a quick script to test my connection to an ORACLE database from PHP, please!
Or if someone has one close at hand could they please post it.
What I have so far is:
<?php
$ORACLE_HOME = '/oracle_client/product/10.2.0';
$ORACLE_SID = 'intappt.world';
$TNS_ADMIN='./oracle_client/product/10.2.0/network/admin';
putenv($ORACLE_HOME);
putenv($ORACLE_SID);
putenv($TNS_ADMIN);
$db_conn = ocilogon("user", "password", "IPofORACLEbox");
$cmdstr = "select * from test";
$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);
$nrows = ocifetchstatement($parsed, $results);
echo "<html><head><title>Oracle PHP Test</title></head><body>";
echo "<center><h2>Oracle PHP Test</h2><br>";
echo "<table border=1 cellspacing='0' width='50%'>\n<tr>\n";
echo "<td><b>Name</b></td><td><b>Age</b></td></tr>\n";
for ($i = 0; $i < $nrows; $i++ )
{
echo "<tr>\n";
echo "<td>" . $results["NAME"][$i] . "</td>";
echo "<td>$ " . number_format($results["AGE"][$i], 2). "</td>";
echo "</tr>\n";
}
echo "<tr><td colspan='2'> Number of Rows: $nrows</td></tr></table>";
<br></center></body></html>\n";
?>
Could someone tell me if and where I'm going wrong on this one.
Thanx in advance!!