How to check availability of a room booked | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to check availability of a room booked

bookeddetail table check-in, checkout, room type, username, room required, nights stay, room price, amount. inserted into database on submit. post method. PHP MySQL js website for hotel reservation. Question is How to add bookedroomno. field in bookeddetails table for example they select 3 out of 4 room and store in db? How to check availability of a room booked for checkin and checkout? how to show availability for rooms types and room count and id? how to disable booking for already booked date

2nd Jan 2018, 1:15 PM
vinayagam D
vinayagam D - avatar
4 Answers
+ 5
Can you share the tables structure definition? it is difficult to imagine what you're trying to accomplish, and how you are doing things to get to your goal this way. It would also help if you describe your current steps to approach the solution, what you have tried, and how it goes, or if it didn't work.
2nd Jan 2018, 2:07 PM
Ipang
+ 2
I'm afraid I can't give you any suggestion for question #1, as I have no idea how the bookeddetail table relationship with rooms table, amof I have no idea how your rooms table look like. As for the other 3 questions, they are all related to room availability, My idea is to have a table, say named "room_status" where it contains room status information from day to day. My idea for the table fields would be as follows (not in SQL command): room_status room_id (reference to rooms) date_time status (0 - Unoccupied, 1 - Reserved, 2 - Occupied, 3 - Maintenance) This way you can check availability by querying the status field. The drawback is you will need to populate the table with records for each room for at least one year range ahead, but you can use PHP to do that. The benefit is you can easily check which rooms were available between a certain period of time.
2nd Jan 2018, 6:42 PM
Ipang
+ 1
changed the table details...
2nd Jan 2018, 4:56 PM
vinayagam D
vinayagam D - avatar
+ 1
how to update the status .whether room booked or not after form submission . or before. ? how to code .check the availability and query ? here only room count we get how to link this availability parameter with form submission code.?
3rd Jan 2018, 4:04 AM
vinayagam D
vinayagam D - avatar