-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEliminarReserva.php
More file actions
38 lines (30 loc) · 1.03 KB
/
Copy pathEliminarReserva.php
File metadata and controls
38 lines (30 loc) · 1.03 KB
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
<?php
include('head.php');
include('conn/conexion.php');
$MiConexion = ConexionBD();
// Verificar si el ID de la reserva está presente en la URL
if (isset($_GET['id'])) {
$idReserva = $_GET['id'];
// Consulta para eliminar el cliente de la base de datos
$SQLdelete = "DELETE FROM `reservas-vehiculos`
WHERE idReserva = ?";
$stmt = $MiConexion->prepare($SQLdelete);
$stmt->bind_param("i", $idReserva);
$stmt->execute();
// Verificar si la eliminación fue exitosa
if ($stmt->affected_rows > 0) {
// Redirigir al listado de clientes con un mensaje de éxito
header('Location: reservas.php?mensaje=El cliente ha sido eliminado correctamente.');
exit();
} else {
// Si no se eliminó ningún registro, mostrar un mensaje de error
header('Location: reservas.php?mensaje=Error al eliminar el cliente.');
exit();
}
}
else {
// Si no se pasó un ID, redirigir al listado de reservas
header('Location: reservas.php');
exit();
}
?>