In the database, I have three user types -- admin, student, teacher. I am making a javascript game which every account type can access. How can I check to see if the user accessing the game is admin, teacher, or student from the database.
There is a database called "user" in mysql and there is a "role" column in the user database and each user is assigned a role 1-3. 3 is the role assigned for students.
In my file, I want to do something like:
if the role of user is student (3)
window.location = '/student_dashboard';
else
window.location = '/other_dashboard';
How can I do this in the file?