Multiple Like clauses with where condition in CodeIgniter
Many time we stuck in some situation if we want add multiple like queries with where condition,
So for this, you should use Grouping where clause, see below example:
So for this, you should use Grouping where clause, see below example:
$this->db->where('status','1');
$this->db->group_start(); //group start
$this->db->like('contact_name',$filter_key);
$this->db->or_like('contact_email',$filter_key);
$this->db->or_like('contact_number',$filter_key);
$this->db->or_like('company_name',$filter_key);
$this->db->group_end(); //group end
$query = $this->db->get('contacts');
Comments
Post a Comment