代码如下 ,谁懂,帮看看 谢谢
<?php$db_conn = ocilogon( "root", "222222","tests" );$cmdstr = "select Gal, Gal_id from Gall";$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>\n<td><b>Salary</b></td>\n</tr>\n";for ($i = 0; $i < $nrows; $i++ )
{
echo "<tr>\n";
echo "<td>" . $results["Gal"][$i] . "</td>";
echo "<td>$ " . number_format($results["Gal_id"][$i], 2). "</td>";
echo "</tr>\n";}echo "<tr><td colspan='2'> Number of Rows: $nrows</td></tr></table>";
echo "<br><em>If you see data, then it works!</em><br></center></body></html>\n";?>
<?php$db_conn = ocilogon( "root", "222222","tests" );$cmdstr = "select Gal, Gal_id from Gall";$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>\n<td><b>Salary</b></td>\n</tr>\n";for ($i = 0; $i < $nrows; $i++ )
{
echo "<tr>\n";
echo "<td>" . $results["Gal"][$i] . "</td>";
echo "<td>$ " . number_format($results["Gal_id"][$i], 2). "</td>";
echo "</tr>\n";}echo "<tr><td colspan='2'> Number of Rows: $nrows</td></tr></table>";
echo "<br><em>If you see data, then it works!</em><br></center></body></html>\n";?>
在选择数据库时加上mysql_query("SET NAMES 'UTF-8'");