<?php
include 'db.php';
include 'auth_check.php';

if (!isset($_GET['id'])) {
    die("Product ID is required.");
}

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

// Delete the product
$sql = "DELETE FROM purchase_stock WHERE id=$id";

if ($conn->query($sql)) {
    header("Location: inventory.php?msg=Product deleted successfully");
    exit;
} else {
    echo "Error deleting record: " . $conn->error;
}
?>
