php阿拉伯语字符串,按字母顺序命名阿拉伯语名称Mysql和php
我試圖用阿拉伯語對 alphabetical order 中的結(jié)果進(jìn)行排序,但出于某種原因 not sorting correctly ..
$ d1 = mysqli_query($ connector,“SELECT * FROM article where type ='1'ORDER BY name ASC”); while($ a1 = mysqli_fetch_array($ d1)){echo“$ a1 [name]”; }
這應(yīng)該顯示結(jié)果A-z排序或阿拉伯語:
????
????
????
????
????
????
???
??????
但顯示結(jié)果ilke:
????
????
????
??????
????
????
????
???
注意:我使用的是utf-8編碼, utf8_general_ci
Full Mysql Code ::
CREATE TABLE IF NOT EXISTS `article` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
`type` int(11) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;
INSERT INTO `article` (`id`, `name`, `type`, `content`) VALUES
(1, '222', '', 'tst'),
(2, '111', '', '121'),
(3, '????', '', 'cont..'),
(4, '????', '', 'cont..'),
(5, '????', '', 'cont..'),
(6, '????', '', 'cont..'),
(7, '????', '', 'cont..'),
(8, '????', '', 'cont..'),
(9, '????', '', 'cont..');
PHP Code :
$host = 'localhost';
$user = 'root';
$pass = '123';
$dbname = 'article_test';
$connector = mysqli_connect($host, $user, $pass, $dbname) or die("Problem occured while connecting to Mysql Server..");
$d1 = mysqli_query($connector,"SELECT * FROM `article` where `type`='1' ORDER BY `name` ASC");
while($a1 = mysqli_fetch_array($d1)){
echo"$a1[name]
";
}
結(jié)果應(yīng)該是:
111
222
????
????
????
????
????
????
????
有人有線索嗎 ?
總結(jié)
以上是生活随笔為你收集整理的php阿拉伯语字符串,按字母顺序命名阿拉伯语名称Mysql和php的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python学习笔记(5):Python
- 下一篇: mysql gui 修改密码_MySQL