CakePHP 1.3 插件:数据库错误

发布于 2025-01-07 07:29:28 字数 809 浏览 0 评论 0原文

我正在尝试为 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。

帮助!

I am attempting to create a plugin for CakePHP 1.3, but I am having the following error that is frustrating me:

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

I have tried multiple things but have not come up with a solution;

Basically I call the following from my app_controller.php file:

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

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

And then I have the following in my visitor.php model file in my plugin

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

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

The strange thing is that even if I comment out the above function I still get the same MySQL error 1064.

Help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

摘星┃星的人 2025-01-14 07:29:28

尝试将 $this->Visitors->process($this->here); 中的“Visitors”更改为“Visitor”(单数)。

Try changing 'Visitors' in $this->Visitors->process($this->here); to 'Visitor' (singular).

路还长,别太狂 2025-01-14 07:29:28

您似乎还交换了 app_controller.php 文件的 $uses 数组中的“Visitors”和“Visitor”:

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

应该是

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

It seems also that you have swapped 'Visitors' and 'Visitor' in the $uses array of your app_controller.php file:

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

should be

var $uses = array('Visitors.Visitor');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文