Zend-framework DB:OR而不是AND运算符
发布时间:2020-12-13 14:10:36 所属栏目:PHP教程 来源:网络整理
导读:有这样的zend查询: $select = $this-_table -select() -where('title LIKE ?','%'.$searchWord.'%') -where('description LIKE ?','%'.$searchWord.'%') -where('verified=1 AND activated=1'); 换句话说,它看起来像: SELECT `some_table`.* FROM `some_ta
有这样的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. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |