CodeIgniter Active Record不相等 [英] CodeIgniter Active Record not equal

查看:165
本文介绍了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);

所有没有运气。想法?

推荐答案

根据手册,这应该可以工作:

According to the manual this should work:


自定义键/值方法:

Custom key/value method:

您可以在第一个参数中包含一个运算符,以控制比较:

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-& ; ,看看项目#2。

这篇关于CodeIgniter Active Record不相等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆