branch waiting list with update

This commit is contained in:
2026-09-16 16:27:47 +02:00
parent 7fe956ba9e
commit 434eb8bc48
15 changed files with 687 additions and 22 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
$conn = new mysqli($servername, $username, $password, $dbname);
require_once('include/headscript.php'); // per avere le credenziali DB, se sono lì
// Se le credenziali sono in headscript.php, sposta la connessione DOPO il require.
// Adatta questa parte a come sono definite $servername ecc. nelle tue altre pagine.
if ($conn->connect_error) {
die("Connessione fallita: " . $conn->connect_error);
}
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
header("Location: riepilogo.php?message=error_delete");
exit();
}
$idorder = (int) $_GET['id'];
$conn->begin_transaction();
try {
// 1. Cancella tutte le prenotazioni di questo ordine
$stmt1 = $conn->prepare("DELETE FROM bookingclass WHERE idorder = ?");
$stmt1->bind_param("i", $idorder);
$stmt1->execute();
$stmt1->close();
// 2. Cancella l'ordine
$stmt2 = $conn->prepare("DELETE FROM orderbook WHERE idorderbook = ?");
$stmt2->bind_param("i", $idorder);
$stmt2->execute();
$stmt2->close();
$conn->commit();
header("Location: riepilogo.php?message=success_delete");
exit();
} catch (Exception $e) {
$conn->rollback();
header("Location: riepilogo.php?message=error_delete");
exit();
}
$conn->close();