cakephp OR condition

后端 未结 3 1977
失恋的感觉
失恋的感觉 2021-01-07 21:22

Originaly posted on cakephp Q&A but i\'ll put it up here in hope of getting some answers.

I have a bunch of companies that has a status of 0 as default but somet

3条回答
  •  甜味超标
    2021-01-07 22:15

    I'm not sure to have understood what results you expect. If you want to retrieve all records having status = 0, plus let's say the one having status = 3, you could use an 'IN' instead of an 'OR'.

    In Cake, you would write it like this:

    $status = 3;
    $conditions = array('Company.status' => array(0, $status));
    

提交回复
热议问题