<?php
include "db.php";

if(!isset($_GET['id'])){ echo "<p>No ID provided.</p>"; exit; }
$id = intval($_GET['id']);

$sql = "DELETE FROM cash WHERE id=$id";
if($conn->query($sql)){
    echo "<p style='color:green;'>Transaction deleted successfully!</p>";
    echo "<script>setTimeout(function(){ window.location.href='cash_view.php'; }, 1500);</script>";
} else { echo "<p style='color:red;'>Error: ".$conn->error."</p>"; }
?>
