|
Posted by Nayeem on 05/17/05 11:41
Dear All,
I'm new to PHP programming and I just try to display small information from
database on web page but its shows blank page. So my code is mention below
and let me know what's wrong in it but when I execute same program on
command prompt then its shows all result correctly with HTML Tags
<?php
PutEnv("ORACLE_SID=TSH1");
PutEnv("ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1");
PutEnv("TNS_ADMIN=/var/opt/oracle");
$db_conn = ocilogon("scott", "tiger", "");
$cmdstr = "select ename, sal from emp";
$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);
$nrows = ocifetchstatement($parsed, $results);
echo "Found: $nrows results<br><br>\n";
echo "<table border=1 cellspacing='0' width='50%'>\n";
echo "<tr>\n";
echo "<td><b>Name</b></td>\n";
echo "<td><b>Salary</b></td>\n";
echo "</tr>\n";
for ($i = 0; $i < $nrows; $i++ ) {
echo "<tr>\n";
echo "<td>" . $results["ENAME"][$i] . "</td>";
echo "<td>$ " . number_format($results["SAL"][$i], 2). "</td>";
echo "</tr>\n";
}
echo "</table>\n";
?>
[Back to original message]
|