我正在使用mysql_fetch_assoc()
获取数据字符串是阿拉伯语,它就像这样回复?????
我尝试过编码但没有工作。
$dbc = mysql_connect("localhost", "root", "", "tedmon") or die("Error 3: " . mysql_error());
mysql_query("SET NAMES utf8");
mysql_query("SET character-set utf8");
$sqlForStudent = "SELECT `MONITORING_PROVINCE`,count(*) FROM `student_interview` group by `MONITORING_PROVINCE`";
$sqlForadmin = "SELECT `pro`,count(*) FROM `ttc_admin_interview` group by `pro`";
$sqlForteacherev = "SELECT `pro`,count(*) FROM `ttc_teachers_evaluation` group by `pro`";
$sqlForteacherint = "SELECT `pro`,count(*) FROM `ttc_teachers_interview` group by `pro`";
$studentset = mysql_query($sqlForStudent);
$adminset = mysql_query($sqlForadmin);
$teacherevset = mysql_query($sqlForteacherev);
$teacherintset = mysql_query($sqlForteacherint);
while($teacherevres = mysql_fetch_array($teacherevset)){
echo $teacherevres['pro'];
}
答案 0 :(得分:1)
从
改变mysql_query("SET NAMES utf8");
mysql_query("SET character-set utf8");
要
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
确保您在charset
页面中添加了head
。
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
注意
mysql
扩展自PHP 5.5.0起已弃用,自PHP 7.0.0起已被删除