[eluser]monoclonal[/eluser]
Hi everyone,
I have a MySQL database which I have set up as a UTF-8 charset and utf8_unicode_ci collation as the data I need to store contains greek letters (alpha, beta etc) as well as other funky symbols and whatnot. The problem I am having is that when selecting data [SELECT * FROM mytable ORDER BY myutf8column] and echoing in php view the table is not sorted properly. For example, this is what i get when ORDER BY ASC on this column;
Potassium
Suramin
β-Estradiol
(±)-Epinephrine
6-Carboxyfluorescein
Acetylcholine chloride
Boric acid
I am using codeigniter 2.1, the database connection settings are using UTF-8 charset and utf8_unicode_ci collation, which is what the database is also using.
If I do the query in phpmyadmin it works fine.
I've tried the query from php/CI using
Code:
$this->db->query("SELECT * FROM table ORDER BY column")
as well as
$this->db->order_by("column")
$this->db->select("SELECT * FROM table")
Just a thought, does the order of order_by() and select() matter?
Both methods give the incorrect sorting. Any suggestions?