Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP分页给出了一个;限制20偏移量0“;错误_Php_Mysql_Sql Server_Cakephp_Pagination - Fatal编程技术网

CakePHP分页给出了一个;限制20偏移量0“;错误

CakePHP分页给出了一个;限制20偏移量0“;错误,php,mysql,sql-server,cakephp,pagination,Php,Mysql,Sql Server,Cakephp,Pagination,我正在尝试获取所有用户,并为此使用分页 public function index() { $this->paginate = [ 'contain' => ['Groups'] ]; $users = $this->paginate($this->Users); $this->set(compact('users')); $this->set('

我正在尝试获取所有用户,并为此使用分页

public function index()
    {
        $this->paginate = [
            'contain' => ['Groups']
        ];
        $users = $this->paginate($this->Users);

        $this->set(compact('users'));
        $this->set('_serialize', ['users']);
    }
但是在
$this->paginate
之后,我得到了一个

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 'groups Groups ON Groups.id = (Users.group_id) LIMIT 20 OFFSET 0' at line 1
找不到导致此问题的原因


有人知道我为什么会遇到这个问题吗?

您必须重命名表组。因为这是保留字。您可以在此处查看有关保留字的更多详细信息:


另一种解决方案可能是将保留字包装在`(严重重音)

中。如果您使用CakePHP:)配置中启用的identifierQuoting选项,则会进行包装。请参阅这是语法错误或访问冲突:1064指示的内容。限制偏移量语法中没有错误是的,确切地说:)我指出了如何使标识符引用不存在保留关键字问题的解决方案。哦。。。对不起,我的错,你完全正确,好人