<?php
    require_once("../../php/db_utils.php");
    
    try {
        // Connect to the database
        $database = db_connect();
        
        // Incoming data
        $canvasId = $_POST["canvas_id"];
        $username = $_POST["username"];
        $collaborator = $_POST["collaborator"];
        
        // Declare query
        $query = "DELETE FROM collaborators WHERE canvas_id = '" . $canvasId . "' AND owner = '" . $username . "' AND collaborator = '" . $collaborator . "';";
        
        // 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);
    }
?>