我无法获得查询以返回预期结果。从cakephp 1.1迁移到1.3。目前,我的新查询不会返回任何结果。一旦我得到结果,我需要限制为5.我的$sqlConditions
数组中的now()是否正确?有什么建议?谢谢你的期待。
function listcomingevents() {
$conditions="EventsDate.start_date>=now()";
$this->weekevent="EventsDate.start_date ASC";
$listcomingeventdata=$this->EventsDate->findAll($conditions,'',$this->weekevent,'5');
return $listcomingeventdata;
}
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()");
答案 0 :(得分:1)
只需将NOW()
表达式直接放在左侧,例如
$sqlConditions = array( "EventsDate.start_date >= CURDATE()");