Aucune description

deleteQuestion.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!---
  2. Developer: Coralys Cubero Rivera
  3. Fall 2018
  4. This script deletes a selected row from the 'questions' table and then returns
  5. the user to the bank of questions main page.
  6. Updated by: Víctor A. Hernández
  7. Summer 2019
  8. --->
  9. <?php
  10. require_once 'processes/config.php';
  11. require_once 'processes/dbh.inc.php';
  12. // IF USER ENTERS PAGE AFTER YES BUTTON HAS BEEN PRESSED (FROM confirmDeleteQuestion.php), DELETE QUESTION FROM DATABASE
  13. // ELSE DO NOTHING
  14. if(isset($_GET['del'])) {
  15. $query = "DELETE FROM `question` WHERE `id`='".$_GET['del']."';";
  16. if(!mysqli_query($connection, $query)) die("Error: ".mysqli_error($connection));
  17. // HAY QUE BORRAR CADA ASOCIACIÓN PREGUNTA-TIPODEPREGUNTA (sería con un while()? o se 'seleccionan' todos y se borran a la vez?)
  18. /*
  19. $query = "DELETE FROM `question_type` WHERE `id_question`='".$_GET['del']."';";
  20. if(!mysqli_query($connection, $query)) die("Error: ".mysqli_error($connection));
  21. */
  22. // WHY NOT USE header INSTEAD OF window.top.location?
  23. //header('Location: http://emaapp.online/admin_nuevo/bankOfQuestions.php');
  24. //exit();
  25. echo "<script>window.top.location='http://emaapp.online/admin_nuevo/bankOfQuestions.php'</script>";
  26. }