gpt4 book ai didi

mysql - 如何用 ci 中具有相同列和不同条件的单个关联数组替换多个 where 子句

转载 作者:行者123 更新时间:2023-11-29 23:46:27 25 4
gpt4 key购买 nike

$this->db->where('column','value1');
$this->db->where('column','value12');
$this->db->where('column','value3');

我想要类似的东西

$where_array = array('column'=>value1,'column'=>value2,'column'=>value3);
$this->db->where($where_array);

这可能吗,因为我们不能在关联数组中具有相同的索引名称

更新:

每种条件彼此不同,如下所示:

$this->db->where('column<','value1');
$this->db->where('column>','value12');
$this->db->where('column<=','value3');

最佳答案

希望您的情况处于状态。然后尝试下面的代码。

$values= array(value1,value2,value3);
$this->db->where_in('column', $values);

对于操作之间

https://ellislab.com/forums/viewthread/102635/

关于mysql - 如何用 ci 中具有相同列和不同条件的单个关联数组替换多个 where 子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25909272/

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