System: Windows NT 5.1 build 2600 (Windows XP Professional Service Pack 3) i586
Oracle客户端 : Instant Client 11.2.0.3.0 (32-bit)
XP IIS: V5.1
PHP: 5.4.11
Compiler:MSVC9 (Visual C++ 2008)
Server API: CGI/FastCGI
代码:
<?php
$c = oci_pconnect("sys","aaa","//192.168.1.2/ORCL",
"ZHS16GBK");
if (!$c) {
$e = oci_error();
trigger_error('Could not connect to database: '. $e['message'],E_USER_ERROR);
}
$s = oci_parse($c, "select 名称 from 部门表 where ID=49");
if (!$s) {
$e = oci_error($c);
trigger_error('Could not parse statement: '. $e['message'], E_USER_ERROR);
}
$r = oci_execute($s);
if (!$r) {
$e = oci_error($s);
trigger_error('Could not execute statement: '. $e['message'], E_USER_ERROR);
}
echo "<table border='1'>\n";
$ncols = oci_num_fields($s);
echo "<tr>\n";
for ($i = 1; $i <= $ncols; ++$i) {
$colname = oci_field_name($s, $i);
echo " <th><b>".htmlentities($colname, ENT_QUOTES)."</b></th>\n";
}
echo "</tr>\n";
while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>".($item!==null?htmlentities($item,
ENT_QUOTES):" ")."</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
var_dump($s,$c);
?>

这里中文都没有显示,查了了下ORALCE的编码是ZHS16GBK