deleteUpdateQuestion.php 751 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. $root = $_SERVER['DOCUMENT_ROOT'];
  3. include($root . "/util/session.php"); //checks that the user is logged in
  4. unset($_SESSION['questionAdd']);
  5. unset($_SESSION['IDupd']);
  6. unset($_SESSION['type']);
  7. $_SESSION['questionUpdDel'] = 'true';
  8. if(isset($_GET['IDdel']))
  9. {
  10. $ID = $_GET['IDdel'];
  11. $sql_delete = "DELETE FROM questions WHERE questionID = $ID";
  12. if (mysqli_query($db, $sql_delete)) {
  13. mysqli_close($db);
  14. } else {
  15. echo "Error: " . $sql . "<br>" . mysqli_error($db);
  16. }
  17. }
  18. else if(isset($_GET['IDupd']) && isset($_GET['type']))
  19. {
  20. $ID = $_GET['IDupd'];
  21. $type = $_GET['type'];
  22. $_SESSION['IDupd'] = "$ID";
  23. $_SESSION['type'] = "$type";
  24. }
  25. header("location: ../teacher.php");