我要怎么做才能让我具备以下条件:
$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')。
感谢您的帮助:)
发布于 2010-12-22 10:08:28
您可以尝试使用where$ CodeIgniters ->db->where_in()函数:
$this->db->where_in('msgto.msgto_recipient', array($userid, 4));我遇到了一个类似的问题,我需要让条件为真并具有多个可能的值,这就起到了作用。
我的情况是,我想查找其状态为已发布或锁定状态的内容。
$this->db->where_in('status', array('published','locked'));发布于 2010-12-21 04:11:47
根据CodeIgniter的文档,我不确定CodeIgniter的查询构建器是否足够强大来处理这种情况。您可能需要先对收件人进行查询,然后手动筛选结果。
https://stackoverflow.com/questions/4493438
复制相似问题