【问题标题】:codeigniter active record, get where array of valuescodeigniter 活动记录,获取值数组
【发布时间】:2014-03-14 06:12:12
【问题描述】:

我需要获取数组中 id 所在的行。

例如,

$array = (1,2,67,102,178,678);

查询后我需要 id=1,id=2,id=67,id=102,id=178,id=678 的行

我想以这种方式更新记录

【问题讨论】:

  • 使用$this->db->where_in()

标签: codeigniter activerecord where-clause


【解决方案1】:

你可以使用where_in:

$this->db->where_in('id', $array);

要检索记录,请使用:

$this->db->get('table_name')->result();

要更新记录,请使用:

$this->db->update('table_name');

【讨论】:

    猜你喜欢
    • 2014-04-05
    • 2013-03-27
    • 2012-07-05
    • 1970-01-01
    • 1970-01-01
    • 2012-03-11
    • 2014-02-22
    • 2014-12-15
    • 1970-01-01
    相关资源
    最近更新 更多