我有这些表users
,tasks
,roles
,permissions
&数据透视表permissions_roles
。
作用:
role_id
:auto_increament role_name
:admin / standard 权限:
permission_id
:auto_increament permission_name
:创建/编辑/删除数据透视表:permissions_roles
p_id(FOREIGN KEY (r_id) REFERENCES roles(role_id))
r_id(FOREIGN KEY (p_id) REFERENCES permissions(permission_id))
但是,当我尝试将数值插入数据透视表时,通过编写此代码:
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
我需要为每个角色分配多个权限。请帮忙。