Search the Community
Showing results for tags 'assign role'.
-
here is a code of sign in page I want to add a role access for the student, teacher, and admin I have table name student in the database and a column role see image attached for database include("dbconfig.php"); session_start(); if($_SERVER["REQUEST_METHOD"] == "POST") { // username and password sent from form $name = mysqli_real_escape_string($con,$_POST['name']); $password = mysqli_real_escape_string($con,$_POST['password']); $sql = "SELECT user_id FROM student WHERE name = '$name' and password = '$password'"; $result = mysqli_query($con,$sql); $row = mysqli_fetch_array($result,MYSQLI_ASSOC); // $active = $row['active']; $count = mysqli_num_rows($result); if($count == 1) { //session_register("name"); $_SESSION['login_user'] = $name; header("location: allstudents1.php"); }else { $error = "Your Login Name or Password is invalid"; } } ?>