Alpha Index不会返回带重音的字母

时间:2012-03-24 16:51:24

标签: php

我有一个alpha索引(A | B | C | D | ...)来编目歌词,所以如果用户想要列出所有以“A”开头的歌词,他只需点击“A”即可。但是返回的结果并没有显示“À”开头的歌词,例如“pedspedras da rua”。

这是我得到的代码:

switch($task){
    case "listforletter":
        $action = "index.php?option=".$option."&Itemid=".$Itemid.
            "&task=".$task."&letter=".$letter;
        if($letter!='0')
            $database->setQuery(
                    "SELECT COUNT(a.id) FROM #__jmovies as a WHERE a.access <= ".
                    (int)$my->gid." AND SUBSTRING(a.title,1,1)='".$letter."'");
        else
            $database->setQuery(
                    "SELECT COUNT(a.id) FROM #__jmovies as a WHERE a.access <= ".
                    (int)$my->gid." AND (SUBSTRING(a.title,1,1)='0'");
        $total = $database->loadResult();
        break;
}

我怎样才能得到“A”开头的所有结果,包括带有“À”等重音字母的结果?

1 个答案:

答案 0 :(得分:0)

我相信:

... SUBSTRING(a.title, 1, 1) COLLATE utf8_general_ci = '" . $letter . "' ...