gpt4 book ai didi

php - 使用 PHP 和 MySQL 按字母顺序检索阿拉伯语单词

转载 作者:行者123 更新时间:2023-11-29 02:22:26 25 4
gpt4 key购买 nike

我想按字母顺序查看阿拉伯语名称。

我的 table :

enter image description here

代码:

<?php
$dbhost="xx";
$dbuser="xxx";
$con = mysqli_connect($dbhost,$dbuser, "");
if (!$con)
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

mysqli_select_db($con,'xxx');;

$query = "SELECT * FROM `boardteam` ORDER BY fName ASC";
mysqli_query($con,"set character_set_server='utf8'");
mysqli_query($con,"set fName 'utf8'");
$result = mysqli_query($con,$query);
if ($result)
{
while($db_field = mysqli_fetch_assoc($result))
{
$tname ="";
switch ($db_field['titleName'])
{
case "Dr":
$tname = "د.";
break;
case "Ms":
$tname = "السيدة.";
break;
case "Mr":
$tname = "السيد.";
break;
}
$members .= "<li><a href='browseMember.php?id=".$db_field['nationalID']."'>".$tname." ".$db_field['fName']." ".$db_field['sName']." ".$db_field['lName']."</a></li>";
}
}
mysqli_close($con);
?>

FYI 文本出现在数据库中是这样的:

enter image description here

最佳答案

尝试

mysqli_set_charset($con, "utf8");

关于php - 使用 PHP 和 MySQL 按字母顺序检索阿拉伯语单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29514648/

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