first commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
include('Connections/bkngstm.php');
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione fallita: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Cancellazione del record
|
||||
if (isset($_GET['idorder'])) {
|
||||
$idorder = $_GET['idorder'];
|
||||
|
||||
// Utilizzo di prepared statement per evitare SQL injection
|
||||
$stmt = $conn->prepare("DELETE FROM orderbook WHERE idorderbook = ?");
|
||||
$stmt->bind_param("i", $idorder);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo "Ordine cancellato con successo!";
|
||||
} else {
|
||||
echo "Errore nella cancellazione: " . $conn->error;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
// Reindirizzamento alla pagina orderbooklist.php
|
||||
header("Location: orderbooklist.php");
|
||||
exit();
|
||||
} else {
|
||||
echo "ID ordine non valido.";
|
||||
// Potresti voler aggiungere un reindirizzamento anche qui, se desideri
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in New Issue
Block a user