阿拉伯字符"???????"在php和mysql上 [英] Arabic character "???????" on php and mysql
本文介绍了阿拉伯字符"???????"在php和mysql上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的问题,我有一个阿拉伯数据库mysqli UTF8_general_ci,而我的php文件的字符集是UTF-8
当我选择数据时,我得到"?????????????".
在php上,我的管理员可以毫无问题地读写,在php上也可以,但问题是何时从数据库中获取数据!这是我的代码:
here is my problem, i have an arabic database mysqli UTF8_general_ci and the charset of my php file is UTF-8
when i seled data i get "?????????????".
on php my admin i can write and read with no problem, also on php i can, but the problem is when is when i get data from the database! here is my code:
<meta charset="UTF-8"/>
$connexion = new mysqli(HOST_DB,USER_DB,MDP_DB,DB_NAME);
if ($connexion->error) {
die('Une erreur s\'est produite :' .$connexion->error);
}
else{
$sql = "SELECT nom, description, date, formateur, image, prix, lieux FROM news";
if ($result = mysqli_query($connexion,$sql)) {
while ($ligne = mysqli_fetch_assoc($result)) {
echo'
<ul>
<li><figure>
<figcaption>
<h1>'.$ligne["nom"].'</h1>
<p>'.$ligne["description"].'</p>
<strong>اليوم:'.$ligne["date"].'</strong><br/>
<strong>المكان:'.$ligne["lieux"].'</strong><br/>
<strong>المدرس:'.$ligne["formateur"].'</strong><br/>
<strong>الثمن: '.$ligne["prix"].'دينار</strong>
</figcaption>
<img src="Images/'.$ligne["image"].'" height="250px" width="250px">
</figure></li>
</ul>
';
}
}
}
推荐答案
问题出在XAMPP,我夹在Wamp服务器上,重新启动了机器,一切正常,
谢谢大家
The problem is from XAMPP, i swiched to Wamp server and rebooted the machine and all work fine,
Thanks ALL
这篇关于阿拉伯字符"???????"在php和mysql上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文