-
Notifications
You must be signed in to change notification settings - Fork 0
/
order_delete.php
39 lines (32 loc) · 1.49 KB
/
order_delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include('config/db.php');
if (isset($_SESSION['ID'])) {
if ($queryPreparata = $connection->prepare("DELETE FROM orders WHERE ID=?")) {
$IDDaEliminare = mysqli_real_escape_string($connection, $_POST['delete']);
$queryPreparata->bind_param("s",$IDDaEliminare);
if (!$queryPreparata->execute()) {
echo "<div class='alert alert-danger email_alert'>
Impossibile eseguire la query: {$connection->error}
</div>";
} else {
if ($queryPreparata->affected_rows == 0) {
echo "<div class='alert alert-danger email_alert'>
Nessun ordine con quel codice trovato.
</div>";
} else {
header("Location: ./dashboardOrdini.php");
exit(0);
}
}
$queryPreparata->close(); //chiudo query preparata.
} else {
echo "<div class='alert alert-danger email_alert'>
Impossibile eseguire la query: {$connection->error}
</div>";
}
} else {
echo "<div class='alert alert-danger email_alert'>
Non sei loggato come dipendente.
</div>";
}
?>