Hey everyone,
I’m using the Active Record Class to get data from my DB (MySQL).
I’ve set up a form where a User can submit a search query which will call a Model with this line of code:
$this->db->like($field, $value, 'both');
Everything works fine, but now, I my client wants to submit Wildcards (especially the underscore) as well.
E.g. if the DB contains:
‘aa1aa’, ‘aa2aa’, ‘aa3aa’, aaXbc’
$this->db->like($field, 'aa_', 'both');
Should return every four rows. But because of using DB’s like() method, the underscore is escaped, so the query is
WHERE field LIKE "ª\_%"
But I want it to be like this:
WHERE field LIKE "ª_%"
(without the escaped wildcard)
Is there a way to tell CI, it shouldn’t escape underscores?
Thanks in advance!
