我无法让查询返回预期结果。从 cakephp 1.1 迁移到 1.3。目前,我的新查询没有返回任何结果。得到结果后,我需要限制为 5。 now() 在我的$sqlConditions
数组中是否正确?有什么建议么?感谢您的关注。
旧查询 cakephp 1.1:
function listcomingevents() {
$conditions="EventsDate.start_date>=now()";
$this->weekevent="EventsDate.start_date ASC";
$listcomingeventdata=$this->EventsDate->findAll($conditions,'',$this->weekevent,'5');
return $listcomingeventdata;
}
新查询 cakephp 1.3:
function listcomingevents() {
$sqlConditions = array( "EventsDate.start_date >="=>"now()");
//remaining code
$sqlOrderBy = array("EventsDate.start_date asc");
$sqlParams = array('conditions'=>$sqlConditions,'order'=>$sqlOrderBy);
$listcomingeventdata=$this->EventsDate->find('all',$sqlParams);
return $listcomingeventdata;
}
也试过:
$sqlConditions = array("EventsDate.start_date >="=>"CURDATE()");