When I use only one OR
condition from the 3 OR
conditions, the where
clause is not working.
$this->db->where('(delivery_date BETWEEN "'.$from.'" AND "'.$to.'") ');
$this->db->or_where('order_date BETWEEN "'.$odfrom.'" AND "'.$odto.'"');
$this->db->or_where('mumbai_date BETWEEN "'.$mdfrom.'" AND "'.$mdto.'"');
$this->db->where('order_location',$sess_location);
$this->db->where('designer_id',$sess_designer_id);
$this->db->where('is_deleted=',0);
$query= $this->db->limit($length,$start)->get();
return $query->result();
In codeigniter round "or_where" conditions with brackets;
$this->db->where('(delivery_date BETWEEN "'.$from.'" AND "'.$to.'") ');
$this->db->where('((order_date BETWEEN "'.$odfrom.'" AND "'.$odto
.'") OR (mumbai_date BETWEEN "'.$mdfrom.'" AND "'.$mdto.'"))',NULL,false);
$this->db->where('order_location',$sess_location);
$this->db->where('designer_id',$sess_designer_id);
$this->db->where('is_deleted=',0);
$query= $this->db->limit($length,$start)->get();