我該如何在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