- Online Hotel Reservation System in PHP/MySQLi
- You can log in into the admin side using this account: username:[email protected]password:1234
- Simple Venue Booking With PHP MySQL (Free Download)
- TABLE OF CONTENTS
- PHP MYSQL VENUE BOOKING
- PART 1) THE DATABASE
- 1A) VENUE TABLE
- 1B) BOOKING TABLE
- 1C) DUMMY DATA
- PART 2) PHP BOOKING LIBRARY
- PART 3) PHP BOOKING AJAX HANDLER
- PART 4) HTML BOOKING PAGE
- 4A) THE HTML
- 4B) JAVASCRIPT – CHECK SLOT AVAILABILITY
- 4C) JAVASCRIPT – SUBMIT FORM
- DOWNLOAD & NOTES
- SUPPORT
- EXAMPLE CODE DOWNLOAD
- EXTRA BITS & LINKS
- EXTRA) CSV BOOKING REPORT
- COMPLETE YOUR OWN SYSTEM
- COMPATIBILITY CHECKS
- LINKS & REFERENCES
- THE END
- Project: Online Hotel Booking System using PHP and MySQL with Source Code
- About Online Hotel Booking System using PHP MySQL Project Free Download
- Core Features of Complete Online Hotel Booking System
- Server Requirements
- Installation
- Screenshots
- Login Access Information
- Test accounts for payment
- Demonstration
- Free Download Complete Online Hotel Booking System
Online Hotel Reservation System in PHP/MySQLi
This System entitled Online Hotel Reservation System in PHP/MySQLi is designed for Justine’s Guest House Online Hotel Reservation System.
The project is an open-source hotel reservation system in PHP and MySQLi that has an online booking system PHP MySQL. It allows the guest to look for rooms with equivalent rates.
The system can store and retrieve the data of guests and their transactions. And this method conjointly integrated within the booking of hotel rooms.
The Hotel Reservation System in PHP Projects has significant features of the admin facet of this method have the potential to verify the booking, area reservation, and cancellation of transactions. Add, Update, and delete the area, Amenities, Room Types, User, View comments, and issue completely different reports.
Hotel Reservation system setup guide
- Extract the downloaded file then copy it inside your root directory.
You can log in into the admin side using this account:
username:[email protected]password:1234
If you have any questions or suggestions, please feel free to contact me on facebook or simply leave a comment below.
Download the source code of the Hotel Reservation System in PHP Projects here. justines
Simple Venue Booking With PHP MySQL (Free Download)
Welcome to a tutorial on how to create a simple venue booking system with PHP and MySQL. I am pretty sure there are plenty of such “booking” or “reservation” systems out there already. So, here’s one that is slightly different – A barebones version that you can build upon, without any third-party frameworks. Read on!
TABLE OF CONTENTS
PHP MYSQL VENUE BOOKING
All right, let us now get into the details of building a venue booking system with PHP and MySQL.
PART 1) THE DATABASE
1A) VENUE TABLE
-- (A) VENUE CREATE TABLE `venue` ( `venue_id` bigint(20) NOT NULL, `venue_name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ALTER TABLE `venue` ADD PRIMARY KEY (`venue_id`), ADD KEY `venue_name` (`venue_name`); ALTER TABLE `venue` MODIFY `venue_id` bigint(20) NOT NULL AUTO_INCREMENT;
Feel free to add more fields as required – Opening days and hours, number of rooms, capacity, etc…
1B) BOOKING TABLE
-- (B) BOOKING CREATE TABLE `booking` ( `book_id` bigint(20) NOT NULL, `venue_id` bigint(20) NOT NULL, `book_date` date DEFAULT NULL, `book_slot` varchar(32) DEFAULT NULL, `book_name` varchar(255) NOT NULL, `book_email` varchar(255) NOT NULL, `book_tel` varchar(60) NOT NULL, `book_notes` text DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ALTER TABLE `booking` ADD PRIMARY KEY (`book_id`), ADD KEY `venue_id` (`venue_id`), ADD KEY `book_date` (`book_date`), ADD KEY `book_slot` (`book_slot`), ADD KEY `book_name` (`book_name`), ADD KEY `book_email` (`book_email`), ADD KEY `book_tel` (`book_tel`); ALTER TABLE `booking` MODIFY `book_id` int(11) NOT NULL AUTO_INCREMENT;
Next, a table to store all the booking entries.
- book_id Primary key and auto-increment.
- venue_id Foreign key. The venue being booked.
- book_date Date booked for.
- book_slot Time slot booked for. This is an open text field, you can pretty much define any time slots you want.
- book_name book_email book_tel Name, email, and telephone of the person who booked the venue.
- book_notes Optional notes for the booking.
Once again, feel free to add or remove the fields that you want to capture.
1C) DUMMY DATA
-- (C) DUMMY ENTRIES INSERT INTO `venue` (`venue_id`, `venue_name`) VALUES (NULL, 'Room A'), (NULL, 'Room B'), (NULL, 'Room C');
Finally, just 3 dummy rooms to kickstart the demo.
PART 2) PHP BOOKING LIBRARY
pdo = new PDO( "mysql:host=". DB_HOST .";dbname=". DB_NAME .";charset=". DB_CHARSET, DB_USER, DB_PASSWORD, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_NAMED ]); > // (B) DESTRUCTOR - CLOSE DATABASE CONNECTION function __destruct () < $this->pdo = null; $this->stmt = null; > // (C) HELPER FUNCTION - RUN SQL QUERY function query ($sql, $data=null) < $this->stmt = $this->pdo->prepare($sql); $this->stmt->execute($data); > // (D) GET ALL VENUES function getVenue () < $this->query("SELECT * FROM `venue`"); $venue = []; while ($r = $this->stmt->fetch()) < $venue[$r["venue_id"]] = $r["venue_name"]; >return $venue; > // (E) GET BOOKING FOR THE DAY function getBooking ($id, $day="") < // (E1) DEFAULT TO TODAY if ($day=="") < $day = date("Y-m-d"); >// (E2) GET ENTRIES $booking = []; $this->query( "SELECT * FROM `booking` WHERE `venue_id`=? AND `book_date`=?", [$id, $day] ); while ($r = $this->stmt->fetch()) < $booking[$r["book_slot"]] = $r; >return $booking; > // (F) SAVE BOOKING function save ($id, $date, $slot, $name, $email, $tel, $notes="") < // (F1) CHECKS & RESTRICTIONS // @TODO - ADD YOUR OWN RULES & REGULATIONS HERE // MUST BE REGISTERED USER TO BOOK? // MAX # OF RESERVATIONS ALLOWED? // USER CAN ONLY BOOK X DAYS IN ADVANCE? // USER CAN ONLY BOOK A MAX OF X SLOTS WITHIN Y DAYS? // (F2) DATABASE ENTRY $this->query( "INSERT INTO `booking` (`venue_id`, `book_date`, `book_slot`, `book_name`, `book_email`, `book_tel`, `book_notes`) VALUES (. )", [$id, $date, $slot, $name, $email, $tel, $notes] ); // (F3) CONFIRMATION // @TODO - UP TO YOU TO COMPLETE. THIS WILL JUST SEND AN EMAIL TO THE USER. $subject = "Booking Received"; $message = "Thank you, we have received your request and will process it shortly."; @mail($email, $subject, $message); return true; > > // (G) DATABASE SETTINGS - CHANGE THESE TO YOUR OWN! define("DB_HOST", "localhost"); define("DB_NAME", "test"); define("DB_CHARSET", "utf8mb4"); define("DB_USER", "root"); define("DB_PASSWORD", ""); // (H) NEW BOOKING OBJECT $_BOOK = new Booking();
Now that we have established the database, we will create a PHP library to work with it. This looks massive at first, but keep calm and look carefully.
- (A & B) When is $_BOOK = new Booking() created, the constructor will automatically connect to the database. The destructor will close the database connection.
- (C) A helper function to run an SQL query.
- (D to F) The “actual” booking functions.
- getVenue() Get all available venues.
- getBooking() Get all bookings for the selected venue and date.
- save() Save a booking entry. Complete this function on your own – Do your own checks, and the “post-process”.
PART 3) PHP BOOKING AJAX HANDLER
getBooking($_POST["id"], $_POST["date"])); break; // (B) SAVE case "save": echo $_BOOK->save( $_POST["venue"], $_POST["date"], $_POST["slot"], $_POST["name"], $_POST["email"], $_POST["tel"], $_POST["notes"]) ? "OK" : $_BOOK->error; break; >>
Before we proceed with the HTML booking page, let us create an AJAX endpoint. How this page work is very simple, just send:
For example, to check for the booking for a specified venue and date, just send $_POST[«req»] = «check» , $_POST[«id»] = N , and $_POST[«date»] = «YYYY-MM-DD» .
PART 4) HTML BOOKING PAGE
4A) THE HTML
getVenue(); // get venues $mindate = date("Y-m-d"); // min selectable date // $mindate = date("Y-m-d", strtotime("+2 days")); ?>