-
Notifications
You must be signed in to change notification settings - Fork 0
/
customer_delete.php
37 lines (32 loc) · 1.49 KB
/
customer_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
<?php
include('config/db.php');
if (isset($_SESSION['ID'])) {
if ($queryPreparata = $connection->prepare("DELETE FROM customers 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 cliente con quel codice trovato.
</div>";
} else {
header("Location: ./dashboardClienti.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>";
}
?>