Wasim A. Wasim A. - 1 month ago 11
PHP Question

Codeigniter WHERE AND OR together

I am trying to combine Where And OR in Codeigniter via code.


Appeared result is as query

where id=1 and status='live' OR status='dead'

Whereas i need result for this query.

where id=1 and (status='live' OR status='dead');

NOTE: Please don't give solution of string passed as parameter from where function. That's not fit into my code. I Just simplified my problem above.


Just found solution, if it can help some one.

$this->db->where("id",1)->where("(status='live' OR status='dead')");