codeigniter - MySQL Active record query ignoring case -
i have following active record query:
$this->db->select('id, firstname, surname'); $this->db->from('users'); $this->db->where('site_id',$siteid); $this->db->like('firstname', $name); $this->db->or_like('surname', $name); $query = $this->db->get(); this works fine exception names within db can contain upper , lowercase names. if case not match, query fails.
is there way can ignore case query?
one of way manipulate case sensitivity in mysql have firstname field in either upper or lower case in db , convert given string in format , match it.
edit: operator , depends on database use case sensitive or not . in postgres , case insenstive in mysql case sensitive. depends on database using.
edit: working not useful way use ucase() or lcase() function on given field , match lowercase or uppercase of match. though have performance issues.
Comments
Post a Comment