gpt4 book ai didi

php - 像这样从数据库中回显阿拉伯字符串?

转载 作者:行者123 更新时间:2023-11-28 23:54:58 24 4
gpt4 key购买 nike

我正在使用 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'];
}

最佳答案

改变自

mysql_query("SET NAMES utf8");
mysql_query("SET character-set utf8");

mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");

确保您在页面的 head 中添加了 charset

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Note mysql extension is deprecated as of PHP 5.5.0, and has been removed as of PHP 7.0.0

关于php - 像这样从数据库中回显阿拉伯字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31933237/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com