resolve-comments.php 584 B

123456789101112131415161718192021222324
  1. <?php
  2. require_once("../../php/db_utils.php");
  3. try {
  4. // Connect to the database
  5. $database = db_connect();
  6. // Incoming data
  7. $ideaId = $_POST["idea_id"];
  8. // Declare query
  9. $query = 'DELETE FROM comments WHERE idea_id = "' . $ideaId . '";';
  10. // Run query
  11. db_query_no_return($database, $query);
  12. // Close the connection to the database
  13. db_close($database);
  14. }
  15. catch(Exception $e) {
  16. $errorMsg = $e->getMessage();
  17. print_r($errorMsg);
  18. }
  19. ?>