向模型调用函数时出现此错误。
Database Error
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'singleBlockWeekly' at line 1
SQL Query: singleBlockWeekly
这是我的控制器
class BlackoutController extends CalendarAppController
{
var $uses = array('Studio','Blackout','BlackoutRepeatTypeDetails','Calendar.Event');
var $components = array('Accesscontrol','RequestHandler');
function event_checker()
{
$start_date = $this->request->data['start_date'];
$end_date = $this->request->data['end_date'];
$endsOn = $this->request->data['endsOn'];
$repeatType = $this->request->data['repeatType'];
$blockType = $this->request->data['blockType'];
$frequency = $this->request->data['freq'];
$repeatDays = $this->request->data['repeatDays'];
#single type
if($blockType == "single"){
if($repeatType == "weekly"){
$dates = $this->Blackout->singleBlockWeekly($start_date,$endsOn,$repeatDays,$frequency);
debug($dates);
die;
}
}
}
}
这是我的Model
class Blackout extends CalendarAppModel
{
var $name = 'Blackout';
var $useTable = false;
function singleBlockWeekly($startDate,$endDate,$repeatEvery = array(),$freq)
{
/*my code here...brevity...*/
}
}
所以我在这里只是调用停电模型中的 singleBlockWeekly 函数。我想知道为什么即使singleBlockWeekly
函数上没有任何与 SQL 相关的代码,我也会收到奇怪的 SQL 错误?
对你的帮助表示感谢!谢谢!:)