db->where('msgto.msgto_display', 'y'); $this->db->where('msgto.msgto_unread', -6ren">
gpt4 book ai didi

php - "where"+ "or_where, "or_where"省略条件

转载 作者:行者123 更新时间:2023-11-29 14:56:33 26 4
gpt4 key购买 nike

我该如何做才能满足以下条件:

$this->db->where('msgto.msgto_display', 'y');
$this->db->where('msgto.msgto_unread', 'y');

但是接下来有:

$this->db->where('msgto.msgto_recipient', $userid);
$this->db->or_where('msgto.msgto_recipient', 4);

目前,除了读取“or_where”时,它忽略了上述“条件”,因此收件人 4 的结果没有 ('msgto.msgto_display', 'y')('msgto.msgto_unread', 'y') 已标记。

感谢您的帮助:)

最佳答案

您可以尝试使用 CodeIgniters $this->db->where_in() 函数:

$this->db->where_in('msgto.msgto_recipient', array($userid, 4));

我遇到了类似的问题,我需要使条件为真且具有多个可能的值,这成功了。

我的情况是我想查找状态为已发布或锁定状态的内容。

$this->db->where_in('status', array('published','locked'));

关于php - "where"+ "or_where, "or_where"省略条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4493438/

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