有这样的 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。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)