<?php
    require_once("../../php/db_utils.php");
    
    try {
        // Connect to the database
        $database = db_connect();
        
        // Incoming data
        $tag = $_POST["tag"];
        $canvasId = $_POST["canvas_id"];
        
        // Declare query
        $query = "DELETE FROM tags WHERE tag = '" . $tag . "' AND canvas_id = '" . $canvasId . "';";
        
        // Run query
        db_query_no_return($database, $query);
        
        // Close the connection to the database
        db_close($database);
    }
    catch(Exception $e) {
        $errorMsg = $e->getMessage();
        print_r($errorMsg);
    }
?>