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。
帮助!
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
$this->Visitors->process($this->here);
中的“Visitors”更改为“Visitor”(单数)。Try changing 'Visitors' in
$this->Visitors->process($this->here);
to 'Visitor' (singular).您似乎还交换了 app_controller.php 文件的
$uses
数组中的“Visitors”和“Visitor”:应该是
It seems also that you have swapped 'Visitors' and 'Visitor' in the
$uses
array of your app_controller.php file:should be