MySQL by default will make the ORDER BY option in queries case sensitive. This means that rows with the same starting letters (but different case) may be ordered non-alphabetically. There are three solutions to this. One is to force all database entries to be forced to upper-case or lower-case when inserting. Another is to use the collate option. The other solution is to change the query itself.
Option 2 (Thanks to eremit)
mysql_query(“SELECT * FROM names ORDER BY name COLLATE ‘latin1_general_ci’);
The MySQL query for case insensitive ORDER BY is to add the LOWER() to your field name. For instance:
mysql_query(“SELECT * FROM names ORDER BY lastname”);
will be: mysql_query(“SELECT * FROM names ORDER BY LOWER(lastname)“);