0

I got an alpha index (A | B | C | D |... ) to catalogue lyrics, so if the user wants to list all lyrics starting by "A" he simply clicks "A". But the returned results don't show lyrics started by "À" for example "Às pedras da rua".

Here is the code I got:

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;
}

How can I get all the results started by "A" including the ones with accented letters like "À"?

user unknown
  • 35,537
  • 11
  • 75
  • 121
  • I think you need to transliterate http://stackoverflow.com/questions/1284535/php-transliteration says how. – yunzen Mar 24 '12 at 16:54

1 Answers1

0

I believe:

... SUBSTRING(a.title, 1, 1) COLLATE utf8_general_ci = '" . $letter . "' ...
Michael
  • 11,912
  • 6
  • 49
  • 64