Copy & paste student number to the following box, and separate two student numbers with a space.
ID |
Name |
Email |
Reset password |
Block/Activate |
console.log('here {$user_id}');"; // debug trick
// find the TAs in the courses taught by this instructor
$ta_result = mysqli_query(
$con,
"SELECT TA FROM course_ta INNER JOIN courses_table ON course_ta.Course_ID=courses_table.Course_ID WHERE courses_table.Lecturer_User_ID=$user_id"
);
$ta_ids = array(-1); // -1 is non-existent ID
while ($row = mysqli_fetch_assoc($ta_result)) {
array_push($ta_ids, $row['TA']);
}
$ta_ids2 = implode(', ', $ta_ids);
$result = mysqli_query(
$con,
"SELECT * FROM users_table WHERE UserType in ('TA') and User_ID in ($ta_ids2)"
);
}
else if ($_SESSION['user_type'] == "Admin"){
$result = mysqli_query(
$con,
"SELECT * FROM users_table WHERE UserType in ('Lecturer')"
);
}
$num_rows = 0;
while ($row = mysqli_fetch_assoc($result)) {
$pass = $row['Password'];
$btn = "";
if ($row['Status'] == "Active") {
$newstatus = "Blocked";
$btnBlock = "";
} else {
$newstatus = "Active";
$btnBlock = "";
}
echo "" . $row['User_ID'] . " | " . $row['Full_Name'] . " | " . $row['Email'] . " | $btn | $btnBlock |
";
$num_rows += 1;
}
if ($num_rows == 0) {
echo "No TA
";
}
?>