CodeIgniter: How to use WHERE clause and OR clause CodeIgniter: How to use WHERE clause and OR clause codeigniter codeigniter

CodeIgniter: How to use WHERE clause and OR clause


$where = "name='Joe' AND status='boss' OR status='active'";$this->db->where($where);


You can use or_where() for that - example from the CI docs:

$this->db->where('name !=', $name);$this->db->or_where('id >', $id); // Produces: WHERE name != 'Joe' OR id > 50


You can use this :

$this->db->select('*');$this->db->from('mytable');$this->db->where(name,'Joe');$bind = array('boss', 'active');$this->db->where_in('status', $bind);