我该如何在codeigniter中的活动记录中写入此查询。代码点火器中AND的有效记录
SELECT * FROM `post_ads` WHERE `dates` >= '2014-09-20' AND `dates` <= '2014-09-22' ORDER BY `dates` ASC
我试过这个代码,但给了一个空的数组。
$where = "DATE(dates) BETWEEN '2014-09-20' AND '2014-09-22'";
$query = $this->db->where($where)->get('post_ads');
return $query->result();
那么你有什么尝试? – Shaeldon 2014-10-01 09:10:45
没有任何尝试? https://ellislab.com/codeigniter/user-guide/database/active_record.html – Ghost 2014-10-01 09:11:14
$ where =“DATE(日期)BETWEEN'2014-09-20'和'2014-09-22'”; $ this-> db-> where($ where) - > get('post_ads'); – user254153 2014-10-01 09:12:58