-
Notifications
You must be signed in to change notification settings - Fork 3
/
add_flights.php
27 lines (22 loc) · 929 Bytes
/
add_flights.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
<?php
$src = $_POST["src"];
$des = $_POST["des"];
$depart_date = $_POST["depart_date"];
$arrive_date = $_POST["arrive_date"];
$depart_time = $_POST["depart_time"];
$arrive_time = $_POST["arrive_time"];
$airplane_name = $_POST["airplane_name"];
$noOfSeats = $_POST["seats_no"];
$amount = $_POST["amount"];
$conn = mysqli_connect("localhost", "root", "", "Ticket_Booking");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql_query = "INSERT INTO Flight (src, des, depart_time, arrive_time, depart_date, arrive_date, airplane_name, noOfSeats, amount) VALUES ('$src', '$des', '$depart_time', '$arrive_time', '$depart_date', '$arrive_date', '$airplane_name', $noOfSeats, $amount);";
if (mysqli_query($conn, $sql_query)) {
echo "1";
} else {
echo "ERROR: " . mysqli_error($conn);
}
mysqli_close($conn);
?>