Zend-framework DB:OR而不是AND运算符

前端之家收集整理的这篇文章主要介绍了Zend-framework DB:OR而不是AND运算符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有这样的zend查询
$select = $this->_table
               ->select()
               ->where('title LIKE  ?','%'.$searchWord.'%')
               ->where('description LIKE  ?','%'.$searchWord.'%')
               ->where('verified=1 AND activated=1');

换句话说,它看起来像:

SELECT `some_table`.* FROM `some_table` WHERE (title LIKE '%nice house%') AND (description LIKE '%nice house%') AND (verified=1 AND activated=1)

如果我有几个AND句子,zend通过AND运算符连接.如何与OR运算符连接?因为我需要:

...(title LIKE '%nice house%') OR (description LIKE '%nice house%')...

您的帮助将不胜感激.

$this->_table->select()->orWhere($condition);

要构建更复杂的查询(例如子条件),您可能必须使用$this-> table-> getAdapter() – > quoteInto()并手动写入SELECT.

原文链接:https://www.f2er.com/php/130930.html

猜你在找的PHP相关文章