関数をモデルに呼び出すと、このエラーが発生します。
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 エラーが発生するのでしょうか?
あなたの助けは大歓迎です! ありがとう!:)