Tutorialsplane

Codeigniter multiple where Condition


Codeigniter multiple where Condition – It is very simple to add multiple where condition filter in Codeigniter. Codeigniter where condition accepts the conditions as an associative array so can pass multiple conditions easily. Here in this tutorial, we are going to explain how to add multiple where conditions in where clause.


Codeigniter multiple where Condition Example

You can add multiple where condition simply as below-

Codeigniter multiple where Condition Example:

$where_array = array(
               'email'=>'test@gmail.com',
               'status'=>'1'
              );
$table_name = "users";
$limit = 10;
$offset = 0;
$query = $this->db->get_where($table_name,$where_array, $limit, $offset);

If you run the above example it will produce the output something like this –

SELECT * from users where email='test@gmail.com' AND status ='1' limit 0, 10;

On the same way you can add multiple conditions.