I have this function for getting users from database :
function get_users_limited($offset, $limit)
{
$q = $this->db->select('*')
->from('users')
->join('user_profiles', 'user_profiles.user_id = users.id' )
->order_by('users.username asc')
->limit($limit, $offset)
->get();
return $q;
}
And I want to order the results by username asc, but the problem is that it makes difference between A and a and B and b etc.
The problem is that the result looks like this:
Albert
Bob
Caesar
axnGuy
blackboy83
c3p0
and I want this:
Albert
axnGuy
Bob
blackboy83
Caesar
c3p0
Any advice how to ingnore lowercase and uppercase in CodeIgniter?
I need CI specific solution!
I’m not familiar with your php there, and you don’t specify what charset you’re using. Also, it’s not specifically mentioned, but I assume we’re talking MySQL here.
Assuming MySQL, suppose you’re using a charset of utf8.
You can choose a different collation (valid for utf8) in your select such as
Here the table is utf8 charset, and I use the utf8_unicode_ci (ci for case insensitive) collation mode on the
namecolumn.If you were using the default charset of latin1 you’d do something more like:
etc.
Totally unfamiliar with your PHP, but I’d assume it’d look something like this:
Specifying the collation subset of your charset doesn’t set or change the default collation on that column/table.