35251-vm/delete_invoice.php
2025-10-26 16:53:16 +00:00

20 lines
445 B
PHP

<?php
require_once 'db/config.php';
$invoice_id = $_GET['id'] ?? null;
if ($invoice_id) {
try {
$pdo = db();
$stmt = $pdo->prepare('DELETE FROM invoices WHERE id = ?');
$stmt->execute([$invoice_id]);
} catch (PDOException $e) {
// Optional: Log the error or show a generic error message
// For simplicity, we redirect without an error message
}
}
header('Location: invoices.php');
exit;
?>