I want to display user type (admin/ employee) & permissionId after they login, how do I do so?
user: userId, username, userpassword
1, peterparker, 123
2, tonystark, 123
permission: permissionId, permissionName
- 1, admin
- 2, user
permission_user: id, userId, permissionId
- 1, 2, 1
- 2, 1, 2
For permissionId, I have the following code:
<?php include ("dbh.inc.php"); $userId = $_SESSION["usersid"]; $sql = "SELECT permissionId from permission_user WHERE userId = '$userId'"; $result = mysqli_query($conn, $sql);
After that, I am not too sure what syntax is to display the result. For instance, based on the dummy data provided above, we know that Tony Stark is an admin, hence I want it to display “1” which stands for admin.
Source: Ask PHP