FatCat
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Хе-хе...конечно не сортирует, в MySQL вообще с этим проблема, лучше написатьвнешнюю функцию сортировки. Я вот такую функцию использую, может и тебе поможет: Код: function cmp0 ($a, $b) { global $sortby; return strcmp($a[$sortby],$b[$sortby]); } $eng_alphabet = array("All", "A","B","C","D","E","F","G","H","I","J","K","L","M", "N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Other"); $rus_alphabet = array("А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О", "П","Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","Э","Ю","Я"); $rus_small = array("а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","н","о", "п","р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я"); | Ну а потом ты в нужном месте просто применяешь заданные массивы: Код: function alpha() { //Creates the list of letters and makes them a link. global $sortby, $eng_alphabet, $rus_alphabet; $num = count($eng_alphabet) - 1; echo "<center>[ "; $counter = 0; while (list(, $ltr) = each($eng_alphabet)) { echo "<A HREF=\"memberslist.php?letter=$ltr&sortby=$sortby\">$ltr</a>"; if ( $counter == round($num/2) ) { echo " ]\n<br>\n[ "; } elseif ( $counter != $num ) { echo " | \n"; } $counter++; } $num = count($rus_alphabet) - 1; echo " ]<br><br>[ \n\n\n"; $counter = 0; while (list(, $ltr) = each($rus_alphabet)) { echo "<A HREF=\"memberslist.php?letter=$ltr&sortby=$sortby\">$ltr</a>"; if ( $counter == round($num/2) ) { echo " ]\n<br>\n[ "; } elseif ( $counter != $num ) { echo " | \n"; } $counter++; } echo " ]\n</center>\n<br>\n"; // end of HTML } |
|