eg. If I have these variables:
$variable1 = "ABCDEFG"; $variable2 = "AbCDefG";
and stuff in db like these:
ABCDEFG IJKLMNO PQRSTUV ...
And if I try to use the like () method as follows:
function get_users() { $q = $this->db->select('*') ->from('users') ->order_by('created asc') ->like('username', $variable1) ->get(); return $q; }
The result will be OK and find the ABCDEFG entry from the database.
However, if I pass $ variable2 with upper and lower case, the result will be:
function get_users() { $q = $this->db->select('*') ->from('users') ->order_by('created asc') ->like('username', $variable2) ->get(); return $q; }
which is wrong because I need to ignore if it is lowercase or uppercase.
How to solve this?
Btw. my db utf8_general_ci sort
source share