我想按字母顺序查看阿拉伯语名称。
我的表:
代码:
<?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文本在db中显示如下:
答案 0 :(得分:2)
试
mysqli_set_charset($con, "utf8");