php调用出现乱码

php调用出现乱码

<?php
$db= mysqli_connect('localhost','root','zzp8473904','sgms');
//mysql_query('SET NAMES "gbk"');
//mysql_query("SET NAMES 'GBK'");
mysql_query("SET NAMES 'gbk'");
$sql="SELECT * FROM `student`";
$result=mysqli_query($db, $sql);
$num_results=mysqli_num_rows($result);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>学生表格</title>


</head>

<body>
在mysql和phpmyadmin里都可以显示中文,但是经过上面的php文件调用,就不能显示中文了,只是显示问号(?),我不知道该怎么设置了,请高手指点!指点一下,也好!!

用 mysqli 没有必要再指定编码

[复制到剪切板]
CODE:
<?php
$db
mysqli_connect('localhost','root','zzp8473904','sgms');
$sql="SELECT * FROM `student`";
$result=mysqli_query($db$sql);
$num_results=mysqli_num_rows($result);
?> ;


毕业了。。。