Zend Framework Complex Where Statement

前端 未结 4 1433
感动是毒
感动是毒 2021-01-07 03:04

This method is published as offical example

->where(\"price < $minimumPrice OR price > $maximumPrice\") is such method safe?

want to write it as ->where

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-07 03:26

    Try this:

    $query->where('(price < ?', $minPrice)
    ->orWhere('price > ?)', $maxPrice)
    ->where('some = ?', $some_other_variable);
    

    will result: where ((price < $minPrice) OR (price > $maxPrice)) AND (some = $some_other_variable)

    Note the double (( )) in OR part

提交回复
热议问题