Here is the code.
function get_autoComplete($tbl, $data, $field, $value, $where='',$group_by=false,$limit=''){
$this->db->select($data);
$this->db->from($tbl);
if($where!=''){
$this->db->where($where);
}
$this->db->like($field, $value);
if($group_by == true){
$this->db->group_by($field);
}
if($limit !='')
{
$this->db->limit($limit);
}
$query=$this->db->get();
return $query->result();
}
In the second select statement, it seems as though like($field, $value)
is case sensitive.
I want it to be insensitive, so I can search without worrying about upper and lower case.
it has something to do with
$this->db->like($field, $value);
There is no case insensitive version of the like function. What you can do is transform both sides of the comparison to lower case, so that you take that out of the equation.
like('LOWER(' .$field. ')', strtolower($value))