-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
102 lines (58 loc) · 2.28 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once "../hotel/db/db.php";
date_default_timezone_set('Europe/Rome');
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "myhotel";
$conn = new mysqli($servername, $username, $password, $dbname);
if($conn == false){
die("ERROR : could not connect. "
. mysqli_connect_error());
}
//to add Customer
//take all 5 values from the form data
//to delete reservation only id;
$id = $_REQUEST["id"];
$start_date = $_REQUEST["start_date"];
$end_date = $_REQUEST["end_date"];
//perfor
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- bootstrap link -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- bootstrap link -->
<link rel="stylesheet" href="../hotel/css/styles.css">
<title>Delete Page</title>
<div class="container">
<?php
$sql2 = "DELETE FROM myhotel.rooms_reservation WHERE id = '$id'";
$deleteRes = $conn->query($sql2);
if($deleteRes){
echo nl2br("\n Deleted Reservation : $id\n Check-In :$start_date ID: \n "
. " Check-Out :$end_date ");
'<div class=" container mt-3 card text-center" style="width: 18rem;">
<img src="https://cdn.pixabay.com/photo/2016/04/15/11/48/hotel-1330850__480.jpg" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title"></h5>
<p class="card-text">Reservation deleted successfully!</p>';
header("location: roomBooked.php");
}else{
die("record is not deleted it is query error." .mysqli_error($id));
}
//close connection
mysqli_close($conn);
?>
</div>
</head>
<body>
</body>
</html>