where("价格 ?", $minimumPrice, $maximumPrice-6ren">
gpt4 book ai didi

zend-framework - Zend 框架复杂的Where 语句

转载 作者:行者123 更新时间:2023-12-02 01:21:26 27 4
gpt4 key购买 nike

此方法作为官方示例发布

->where("价格 < $minimumPrice 或价格 > $maximumPrice")这样的方法安全吗?

想把它写成->where("价格 < ? 或价格 > ?", $minimumPrice, $maximumPrice)有没有可能?

我无法将其分成 2 个 where 语句,因为计划编写查询->其中(“1或2”)->其中(“3或4”)

最佳答案

试试这个:

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

将导致: where ((price < $minPrice) OR (price > $maxPrice)) AND (some = $some_other_variable)

注意 OR 部分中的 double (( ))

关于zend-framework - Zend 框架复杂的Where 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3899795/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com