2012-02-21 95 views
0

我試圖創造CakePHP的1.3的插件,但我有以下錯誤是令人沮喪的我:CakePHP的1.3插件:數據庫錯誤

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 'process' at line 1 

我已經試過許多東西,但還沒有拿出一個辦法;

基本上我打電話從我app_controller.php文件中的以下內容:

var $uses = array('Visitor.Visitors'); 

function beforeRender(){ 
    $this->Visitors->process($this->here); 
} 

然後,我已經在我的visitor.php模型文件按照我的插件

class Visitor extends VisitorsAppModel { 
    var $name = 'Visitor'; 

    function process($url = null){ 
     $this->deleteInactive(); 
     if($this->_isBot() == FALSE){ 
      $this->_updateVisitor($url); 
     } 
    } 
} 

奇怪的是即使我註釋掉上述函數,我仍然會得到相同的MySQL錯誤1064.

幫助!

回答

0

嘗試將$this->Visitors->process($this->here);中的「訪問者」更改爲「訪問者」(單數)。

0

這也似乎你已經在$uses陣列的app_controller.php文件的交換中 '訪問者' 和 '訪問者':

var $uses = array('Visitor.Visitors'); 

應該

var $uses = array('Visitors.Visitor');