Today, We want to share with you multiple where condition in codeigniter.In this post we will show you where or condition in codeigniter, hear for how to check where condition in codeigniter we will give you demo and example for implement.In this post, we will learn about PHP Codeigniter 3 Multiple WHERE Conditions Example with an example.
Select Query in Codeigniter with Multiple Clause
multiple where condition codeigniter
//Associative array method: $array = array('name' => $name, 'title' => $title, 'status' => $status); $this->db->where($array); // Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date); $this->db->where($array);
How to use multiple where condition in Codeigniter?
$multipleWhere = ['name' => $name, 'email' => $email, 'status' => $status]; $this->db->where($multipleWhere); $this->db->get("shop_name");
$multipleWhere = ['name !=' => $name, 'id <' => $id, 'status >' => $status]; $this->db->where($multipleWhere); $this->db->get("shop_name");
How to use Multiple Where Condition in Codeigniter?
public function getdata(){ $data = array('name' => 'Rockky'); $multiClause = array('id' => $ids, 'name' => $name, 'status' => 1 ); $this->db->where($multiClause); $query = $this->db->get('shop-name', $data); return $query->result(); }
$multiClause = array('id' => $ids, 'name' => $name, 'status' => 1 ); $this->db->where($multiClause);
Insert Query with multiple where condition in Codeigniter
$data = array('name' => 'Rockky'); $multiClause = array('id' => $ids, 'name' => $name, 'status' => 1 ); $this->db->where($multiClause); $query = $this->db->insert('member', $data);
Update query with multiple where Clause in CI
$data = array('name' => 'Rockky'); $multiClause = array('id' => $ids, 'name' => $name, 'status' => 1 ); $this->db->where($multiClause); $this->db->update('member', $data);
Delete Query with multiple where Clause in CI
$multiClause = array('id' => $ids, 'status' => 1 ); $this->db->delete('shop name');
I hope you get an idea about multiple where condition in codeigniter.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.