Codeigniter or where Condition or in Clauses

Today, We want to share with you or where in codeigniter.In this post we will show you where condition in codeigniter, hear for codeigniter get_where multiple conditions we will give you demo and example for implement.In this post, we will learn about orwhere with an example.

How to use multiple where condition in Codeigniter?

Example 1:

$all_condition_query = ['name' => $name, 'email' => $email, 'is_active' => $is_active];

$this->db->where($all_condition_query);

$this->db->get("members_info");

Example 2:

$all_condition_query = ['name !=' => $name, 'id <' => $id, 'is_active >' => $is_active];

$this->db->where($all_condition_query);

$this->db->get("members_info");

orwhere in codeigniter

Example 3:
codeigniter select for update

$table = "members_info";
$id = 1;
$update = ["is_active"=>"padding"];

$query = $this->db->select()
            ->from($table)
            ->where('id', $id)
            ->get_compiled_select();
$data = $this->db->query("$query FOR UPDATE")->row_array();
$this->db->where('id', $data['id'])->update($table,$update);

I hope you get an idea about orwhere not in codeigniter.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment