I need to create this select:
SELECT * FROM units
WHERE ((um like '%str%' AND desc like '%str%') AND deleted = 0)
so i tried using
$search = 'str';
$this->db->from('units');
$this->db->where("(um LIKE '%".$this->db->escape_like_str($search)."%' or
desc LIKE '%".$this->db->escape_like_str($search)."%') and deleted=0");
return $this->db->get();
but that did not work, even though on my other tables, controllers, modules it works fine. edit: I saw why it did not work, because of desc... but still my question goes below...
I tried using this and works properly
$this->db->from('units');
$this->db->where('deleted',0);
$this->db->like('desc', $search);
$this->db->or_like('um', $search);
But this formulates as:
WHERE deleted = 0 AND desc like '%str%' AND um like '%str%'
Can I combine or_like and like as 1? and where deleted as another, because now it shows all the deleted because of the or_like.