subjectsStudentsList.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. <body>
  19. <?php
  20. include($root . "/admin/header.php");
  21. ?>
  22. <li><a href="/admin/subjectList.php?degreeID=<?php echo $degreeID?>">Back</a></li>
  23. <li><a href="/admin/subjectStudentAdd.php?degreeID=<?php echo $degreeID?>&&subjectID=<?php echo $subjectID?>">Add a student</a></li>
  24. <table border="1px" id="users">
  25. <thead>
  26. <tr>
  27. <th>Actions</th>
  28. <th>Degree ID</th>
  29. <th>Subject ID</th>
  30. <th>Student ID</th>
  31. <th>Student Name</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php //ugly php + html hybrid code that does stuff
  36. while($row=mysqli_fetch_assoc($result)){?>
  37. <tr>
  38. <td>
  39. <a href="/admin/subjectsStudentsRemove.php?subjectID=<?php echo $row['subjectID']?>&&degreeID=<?php echo $row['degreeID']?>&&studentID=<?php echo $row['studentID']?>">Remove</a>
  40. </td>
  41. <td><?php echo $row['degreeID']; ?>
  42. </td>
  43. <td><?php echo $row['subjectID']; ?></td>
  44. <td><?php echo $row['studentID']; ?></td>
  45. <td><?php echo $row['full_name']; ?></td>
  46. </tr>
  47. <?php }?>
  48. </tbody>
  49. </table>
  50. <?php
  51. include($root . "/admin/footer.php");
  52. ?>
  53. </body>
  54. </html>