- 論壇徽章:
- 1
|
1.php源碼如下,數(shù)據(jù)庫為db2,連接后頁面不顯示中文,數(shù)據(jù)庫編碼用的utf-8,php文件也是utf-8保存的,望各位大神指點(diǎn)一下:
gongzi表格式如下
A B C
0001 張三 部門1
0002 李四 部門2
0003 王五 部門3
<?php
header("Content-type: text/html; charset=utf-8");
$database = "wwwdb";
$user = "www";
$pass = "www";
$conn = db2_connect($database,$user,$pass);
if ($conn) {
echo "connection succeeded.";
}
else {
echo "connection failed.";
}
$sql = "select trim(A),trim(B),trim(C) from gongzi";
$result = db2_exec($conn,$sql,array('cursor' => DB2_SCROLLABLE));
print "<table border='1'>";
print "<th align = 'center'>員工編號</th>";
print "<th align = 'center'>員工姓名</th>";
print "<th align = 'center'>部門名稱</th>";
while ($row = db2_fetch_array($result))
{
print "<tr>";
print "<td align = 'center'>{$row[0]}</td>";
print "<td align = 'center'>{$row[1]}</td>";
print "<td align = 'center'>{$row[2]}</td></tr>";
}
print "</table>";
db2_close($conn);
?> |
|