Php Codeigniter比较大于或小于同一字段的值的id

Php Codeigniter比较大于或小于同一字段的值的id,php,codeigniter,Php,Codeigniter,我使用CodeIgniter来形成一个无法正常工作的简单查询 我试图获取一个操作\uid大于1但小于4的字段 示例如下: $this->db->where('newsfeeds.action>','1') $this->db->where('newsfeeds.action我认为应该在数组中给出这些条件,并通过get\u where函数传递它们 检查这个 试试这个: $this->db->where('newsfeeds.action >', 1); $this->db

我使用CodeIgniter来形成一个无法正常工作的简单查询

我试图获取一个
操作\uid
大于1但小于4的字段

示例如下:

$this->db->where('newsfeeds.action>','1')


$this->db->where('newsfeeds.action我认为应该在数组中给出这些条件,并通过get\u where函数传递它们

检查这个 试试这个:

$this->db->where('newsfeeds.action >', 1);

$this->db->where('newsfeeds.action <', 4);

您可以在
$this->db->where
中使用多个条件

$where= array('newsfeeds.action >' =>1, 'newsfeeds.action <' => 4)
$this->db->where($where);

$where=array('newsfeeds.action>'=>1,'newsfeeds.action尝试此方法将sql发送到函数

$this->db->query($sql);


您可以通过生成一个包含WHERE条件的字符串来使用它,如

$where = "name='Joe' AND status='boss' OR status='active'";

$this->db->where($where);
希望这会有所帮助

$where= array('newsfeeds.action >' =>1, 'newsfeeds.action <' => 4)
$this->db->where($where);
$where = "name='Joe' AND status='boss' OR status='active'";

$this->db->where($where);