我搜索了这个网络,找不到任何东西可以给我一个很好的例子。 我的问题是:
我如何改变这种状况:
* 摘自表WHERE(a = 1 和 b = 2) OR(c = 3 OR c = 4)和 d = 5;
类似于:
$this ->select() ->from($this->_schema. . .$this->_name) ->where( a = ? , 1 );
因此,如何做到这一点?
事先非常感谢。
我搜索了这个网络,找不到任何东西可以给我一个很好的例子。 我的问题是:
我如何改变这种状况:
* 摘自表WHERE(a = 1 和 b = 2) OR(c = 3 OR c = 4)和 d = 5;
类似于:
$this ->select() ->from($this->_schema. . .$this->_name) ->where( a = ? , 1 );
因此,如何做到这一点?
事先非常感谢。
我也存在同样的问题。 见本答复中的代码例子:< href=”https://stackover.com/ > >。 Grouping WHERA,
因此,你最后想像:
$db = $this->getAdapter();
$this->select()
->where( ( . $db->quoteInto( a = ? , 1) . AND . $db->quoteInto( b = ? , 2) . ) OR ( . $db->quoteInto( c = ? , 3) . OR . $db->quoteInto( c = ? , 4) . ) )
->where( d = ? , 5);
赋予你:
SELECT `table_name`.* FROM `table_name` WHERE ((a = 1 AND b = 2) OR (c = 3 OR c = 4)) AND (d = 5)
(1) 为所有群体创造条件 地点/地点:
$conditions = $this->select()
->where( a= ? , 5)
->orWhere( b= ? , 6)
->getPart(Zend_Db_Select::WHERE);
// result: $conditions = "(a= 5) OR (b= 6)";
使用“部分”方法,以达到条件。
2) 其次,重新确定现有部分选定物体的位置:
$this->select()->reset(Zend_Db_Select::WHERE);
3) 最后,如果情况与你一样:
$this->select()
->where( d= ? , 5)
->where(implode( , $conditions));
rel=“nofollow”http://framework.zend.com/manual/1.12/ru/zendb.select.html
Per a message Board post on the Zend Framework website,这可能是不可能的。
在我看来,在泽德(......)和(或)here的地方 Db_当选人不足以撰写所有询问。 它不支持附加条件的设置,而这种状况在较为复杂的情况下不以抽象的方式强制用户使用。 (a)和(或) 我不能这样说:
<><>Edit>/strong>
<代码>阵容功能 Zend_Db_Select-> where is designed only for use it with the IN
.
Example #17 Example of an array parameter in the where() method
// Build this query:
// SELECT product_id, product_name, price
// FROM "products"
// WHERE (product_id IN (1, 2, 3))
$productIds = array(1, 2, 3);
$select = $db->select()
->from( products ,
array( product_id , product_name , price ))
->where( product_id IN (?) , $productIds);
As Peder said you can t nest orWhere
but you can pass multiple arguments into where
and orWhere
.
$this->select()
->from($this->_schema. . .$this->_name)
->where( ( a = ? AND b = ? ) OR ( c = ? OR c = ? ) , array(1,2,3,4))
->where( d = ? ,array(5));
泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。
I have a Zend Framework application that is making use of jQuery UI. In my controllers, I am setting error/success messages with the FlashMessenger helper like this: // ExampleController.php $this-&...
I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...
Hey guys - here s a question on Zend Framework or better on MVC in general: I am asking myself for a quiet a long time now, if it is a good idea to push business objects (User, Team, etc.) to my ...
I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...
I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...