or condition in codeigniter – write multiple condition in where clause using codeigniter 3 Query Builder class.
or condition in codeigniter
Codeigniter select query with AND and OR condition
$this->db->where('member_rank',140); $this->db->where('is_status','open'); $where = '(check_dt="open" or on_status = "Success")'; $this->db->where($where);
Example
$multipleWhere = ['name' => $name, 'email' => $email, 'status' => $status]; $this->db->where($multipleWhere); $this->db->get("pakainfo_v1");
$multipleWhere = ['name !=' => $name, 'id <' => $id, 'status >' => $status]; $this->db->where($multipleWhere); $this->db->get("pakainfo_v1");
don’t miss : PHP Codeigniter 3 Multiple WHERE Conditions Example
CodeIgniter: How to use WHERE clause and OR clause
$where = "name='raghav' AND status='manager' OR status='off'"; $this->db->where($where);
or_where condition in Codeigniter
$this->db->where('membernm !=', $membernm); $this->db->or_where('id >', $id); // Produces: WHERE membernm != 'deep' OR id > 30
how to use multiple where condition in codeigniter?
$data = array('name' => 'deep'); $multiClause = array('id' => $ids, 'name' => $name, 'status' => 1 ); $this->db->where($multiClause); $query = $this->db->get('pakainfo_v1', $data); return $query->result();
I hope you get an idea about or condition in codeigniter.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.