<?php
session_start();
require_once "db.php";
if(!isset($_SESSION['username'])) exit;
if(!isset($_GET['id'])) exit;
$pid = intval($_GET['id']);
$conn->query("DELETE FROM purchase_items WHERE purchase_id=$pid");
$conn->query("DELETE FROM purchases WHERE purchase_id=$pid");
header("Location: purchase-list.php");
?>
