CodeIgniter Active Record 不相等 [英] CodeIgniter Active Record not equal
本文介绍了CodeIgniter Active Record 不相等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用活动记录的 CodeIgniter 中,如何在 $this->db->where()
中执行不等于.例如:
In CodeIgniter using active record, how do I perform a not equal to in $this->db->where()
. For instance:
$this->db->where('emailsToCampaigns.campaignId', $campaignId);
会做等于,但我不需要等于.我试过了:
Will do equal to, but I need not equal to. I have tried:
$this->db->where('emailsToCampaigns.campaignId <> ', $campaignId);
$this->db->where('emailsToCampaigns.campaignId != ', $campaignId);
$this->db->where('emailsToCampaigns.campaignId', ' != ' . $campaignId);
$this->db->where('emailsToCampaigns.campaignId != ' . $campaignId);
一切都没有运气.想法?
All with no luck. Ideas?
推荐答案
根据手册,这应该可行:
According to the manual this should work:
自定义键/值方法:
您可以在第一个参数中包含一个运算符以控制比较:
You can include an operator in the first parameter in order to control the comparison:
$this->db->where('name !=', $name);
$this->db->where('id <', $id);
Produces: WHERE name != 'Joe' AND id < 45
搜索 $this->db->where();
并查看第 2 项.
Search for $this->db->where();
and look at item #2.
这篇关于CodeIgniter Active Record 不相等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文