connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST['submit_form1'])) {
// Process data from Table A
$hotel_name = $_POST["hotel_name"];
$city_id = $_POST["city_id"];
$location = $_POST["location"];
$hotel_type_id = $_POST["hotel_type_id"];
$seller_id = $_SESSION['uid'];
$description = $_POST["description"];
$start=microtime(true);
// Insert data into the database
$sql1 = "INSERT INTO hotel ( name, city_id, location, hotel_type_id, seller_id, descrip) VALUES ('$hotel_name', '$city_id', '$location','$hotel_type_id', '$seller_id', '$description')";
if ($conn->query($sql1) === TRUE) {
$end = microtime(true);
$execution_time = $end - $start;
$phpVariable = "Add hotel success. Running time: ".$execution_time."s";
echo '';
} else {
$end = microtime(true);
$execution_time = $end - $start;
echo "Error: " . $sql1 . "
" . $conn->error;
}
}
if (isset($_POST['submit_form2'])) {
// Process data from Table B
$hotel_id = $_POST["hotel_id"];
$room_type_id = $_POST["room_type_id"];
$price = $_POST["price"];
$quantity = $_POST["quantity"];
$start=microtime(true);
// Insert data into the database
$sql2 = "INSERT INTO hotel_room (hotel_id, room_type_id, price, quantity) VALUES ('$hotel_id', '$room_type_id', '$price', '$quantity')";
if ($conn->query($sql2) === TRUE) {
$end = microtime(true);
$execution_time = $end - $start;
$phpVariable = "Add room success. Running time: ".$execution_time."s";
echo '';
} else {
$end = microtime(true);
$execution_time = $end - $start;
echo "Error: " . $sql2 . "
" . $conn->error;
}
}
$conn->close();
?>