【发布时间】:2014-04-05 14:18:09
【问题描述】:
我正在使用 codeigniter 和活动记录。我正在使用数组在 WHERE 上选择我的数据。任何这样的。但是如何插入标签“>”和“
$whereQuery['service.service_end_date'] = $start;
感谢您的回复。
【问题讨论】:
标签: sql codeigniter activerecord
我正在使用 codeigniter 和活动记录。我正在使用数组在 WHERE 上选择我的数据。任何这样的。但是如何插入标签“>”和“
$whereQuery['service.service_end_date'] = $start;
感谢您的回复。
【问题讨论】:
标签: sql codeigniter activerecord
这可能是你想要的:
关联数组法:$array = array('name' => $name, 'title' => $title, 'status' => $status);
$this->db->where($array);
// 产生:WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
您也可以使用此方法包含自己的运算符:$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);
$this->db->where($array);
来源:
http://ellislab.com/codeigniter/user-guide/database/active_record.html
【讨论】:
http://ellislab.com/codeigniter/user-guide/database/active_record.html
$whereQuery['service.service_end_date >'] = $start;
$whereQuery['service.service_end_date <'] = $start;
你可以在 CI where 函数中传递> < <>
$this->db->where('field_name <', "Condition_value");
【讨论】:
来自 Codeigniter 页面:
您可以在第一个参数中包含一个运算符以控制比较:
$this->db->where('name !=', $name);
$this->db->where('id <', $id);
// Produces: WHERE name != 'Joe' AND id < 45
【讨论】: