<?php
require_once 'auth.php';

$conn = new mysqli(
    "localhost",
    "root",
    "",
    "tradelicense"
);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

if (!isset($_GET['id'])) {
    header("Location: license_list.php");
    exit;
}

$id = intval($_GET['id']);

$sql = "DELETE FROM details WHERE id = '$id'";

if ($conn->query($sql)) {

    header("Location: license_list.php?deleted=1");
    exit;

} else {

    echo "Delete Failed : " . $conn->error;

}

$conn->close();
?>
