How to use multiple where condition in Codeigniter?

July 19, 2018 | Category : MySQL Codeigniter PHP

Hi Guys,

Here, i will show you how to write multiple condition in where clause using codeigniter 3 Query Builder class. Codeigniter provide set class function for each mysql function like where clause, join etc. So same for where clause, they provide "$this->db->where($array);", so we can use easily.

In this tutorial, you can see two way to add multiple where condition in your codeigniter application. So just let's see both example as below and do it same way:

Example 1:

$multipleWhere = ['name' => $name, 'email' => $email, 'status' => $status];



Example 2:

$multipleWhere = ['name !=' => $name, 'id <' => $id, 'status >' => $status];



As you can see both example.

I hope you find your best....