subjectsStudentsList.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. $root = $_SERVER['DOCUMENT_ROOT'];
  3. include($root . "/util/session.php"); //checks that the user is logged in
  4. include($root . "/util/privilege_check.php");
  5. checkPrivilege("admin");
  6. $degreeID = mysqli_real_escape_string($db, $_GET['degreeID']);
  7. $subjectID = mysqli_real_escape_string($db, $_GET['subjectID']);
  8. $query = "SELECT * FROM students_subjects join user_info on students_subjects.studentID=user_info.login where students_subjects.degreeID='$degreeID' and students_subjects.subjectID='$subjectID' ";
  9. $result = mysqli_query($db, $query);
  10. ?>
  11. <!DOCTYPE html>
  12. <html lang="en">
  13. <head>
  14. <title>Subject Students List</title>
  15. <link rel="stylesheet" type="text/css" href="adminStyle.css">
  16. <link rel="stylesheet" type="text/css" href="tableStyle.css">
  17. </head>
  18. <?php
  19. include($root . "/admin/header.php");
  20. ?>
  21. <main>
  22. <body>
  23. <li><a href="/admin/subjectList.php?degreeID=<?php echo $degreeID ?>">Back</a></li>
  24. <li><a href="/admin/subjectStudentAdd.php?degreeID=<?php echo $degreeID ?>&&subjectID=<?php echo $subjectID ?>">Add a student</a></li>
  25. <table border="1px" id="users">
  26. <thead>
  27. <tr>
  28. <th>Actions</th>
  29. <th>Degree ID</th>
  30. <th>Subject ID</th>
  31. <th>Student ID</th>
  32. <th>Student Name</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <?php //ugly php + html hybrid code that does stuff
  37. while ($row = mysqli_fetch_assoc($result)) { ?>
  38. <tr>
  39. <td>
  40. <a href="/admin/subjectsStudentsRemove.php?subjectID=<?php echo $row['subjectID'] ?>&&degreeID=<?php echo $row['degreeID'] ?>&&studentID=<?php echo $row['studentID'] ?>">Remove</a>
  41. </td>
  42. <td><?php echo $row['degreeID']; ?>
  43. </td>
  44. <td><?php echo $row['subjectID']; ?></td>
  45. <td><?php echo $row['studentID']; ?></td>
  46. <td><?php echo $row['full_name']; ?></td>
  47. </tr>
  48. <?php } ?>
  49. </tbody>
  50. </table>
  51. </body>
  52. </html>
  53. </main>
  54. <?php
  55. include($root . "/admin/footer.php");
  56. ?>