我必须显示from_date和last_date介于当前日期之间的帖子。
$sql = "SELECT * FROM post WHERE status=1 AND CURDATE() between from_date AND last_date";
如上面的查询工作正常,我将如何在cakephp中转换上面的查询?
答案 0 :(得分:0)
查看this page。
$this->Post->find('all', array('conditions' => array(
'status' => 1,
'from_date BETWEEN ? AND ?' => array($from_date, $last_date)
)));