delete-tag.php 643 B

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