<?php
    include('connection.php');
        $path = $_POST['path'];
        $id= $_POST['id'];  
            unlink($path);
            $sql = "Delete from gallery where id='".$id."'";  
            if ($con->query($sql) === TRUE) {

                header('Location: /image-gallery.php');
                
            } else {
                $error="";
                echo "Error: " . $sql . "<br>" . $con->$error;
            }

            $con->close();

?>