<?php
include 'includes/db.php';
$id = intval($_GET['id']);
$car_id = intval($_GET['car_id']);
$doc = $conn->query("SELECT fisier FROM documents WHERE id = $id")->fetch_assoc();
if ($doc) {
    unlink('uploads/' . $doc['fisier']);
    $conn->query("DELETE FROM documents WHERE id = $id");
}
header("Location: edit_car.php?id=$car_id");
?>