php页面显示数据库查询结果是乱码。查了很多资料不能解决。有人碰到过类似问题吗?求高人指点。不胜感谢!
现将代码贴出来
顺便说一句,执行的时候显示下面两行错误。
Warning: mssql_query() [function.mssql-query]: message: 'names' ????????? SET ???䡣 (severity 15) in D:\AppServ\www\a.php on line 20
Warning: mssql_query() [function.mssql-query]: Query failed in D:\AppServ\www\a.php on line 20
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 16-5-25
* Time: 上午10:00
*/
echo "欢迎使用PHP!!";
echo "<br>";
$conn=mssql_connect('localhost','sa','yxz');
mssql_select_db('game',$conn);
mssql_query("SET names gb2312");
//query语句
$Query='select * from userabc';
$AdminResult=mssql_query($Query);
//输出结果
$Num=mssql_num_rows($AdminResult);
for($i=0;$i<$Num;$i++)
{
$Row=mssql_fetch_array($AdminResult);
echo($Row[0]);
echo($Row[1]);
echo($Row[2]);
echo($Row[3]);
echo("<br>");
}
?>
</body>
</html>