-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsertmodifybooked.php
134 lines (71 loc) · 2.81 KB
/
insertmodifybooked.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?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());
}
if (isset($_POST["users_id"])) {
$id = $_POST["id"];
$roomId = $_POST["roomId"];
$reservationId = $_POST["reservationId"];
$users_id = $_POST["users_id"];
$start_date = $_POST["start_date"];
$end_date = $_POST["end_date"];
$sql = "UPDATE myhotel.rooms_reservation SET rooms_id_rooms = '$roomId',
reservation_id_reservation = '$reservationId',
users_id = '$users_id' ,
start_date = '$start_date' ,
end_date = '$end_date'
where id = '$id' ";
if (mysqli_query($conn, $sql)) {
$toReturn =
'<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"> Id : '.$id.' </h5>
<h5 class="card-title"> Reservation Id :'. $reservationId .' </h5>
<h5 class="card-title"> Users Id : '.$users_id.'</h5>
<h5 class="card-title"> Check-In: '.$start_date.'</h5>
<h5 class="card-title"> Check-Out : '.$end_date.'</h5>
<h5 class="card-title"> Room Id : '.$roomId.'</h5>
<p class="card-text">Reservation has been modified successfully</p>';
if($toReturn == true){
header("location: roomBooked.php");
}
} else {
echo "ERROR: Hush! Sorry $sql. "
. mysqli_error($conn);
}
//close connection
mysqli_close($conn);
}
?>
<!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>Document</title>
<div class="container">
<?php
echo $toReturn;
?>
</div>
</head>
<body>
</body>
</html>