解析错误:语法错误,/ home /....../..../中的意外“@”

时间:2017-08-08 12:49:06

标签: php mysql mysqli many-to-many

我有这些表userstasksrolespermissions&数据透视表permissions_roles

作用:

  1. role_id:auto_increament
  2. role_name:admin / standard
  3. 权限:

    1. permission_id:auto_increament
    2. permission_name:创建/编辑/删除
    3. 数据透视表:permissions_roles

      1. p_id(FOREIGN KEY (r_id) REFERENCES roles(role_id))
      2. r_id(FOREIGN KEY (p_id) REFERENCES permissions(permission_id))
      3. 但是,当我尝试将数值插入数据透视表时,通过编写此代码:

        function roles($role_name){
                mysqli_query($this->connect,"INSERT INTO roles ( role_name ) VALUES ('$role_name')");
                SET @r_id = LAST_INSERT_ID();
            }
        

        然后我收到了这个错误:

        解析错误:

        syntax error, unexpected '@' in /home/directory/project_folder/users.php
        

        我需要为每个角色分配多个权限。请帮忙。

0 个答案:

没有答案