Essentially i'm making a basic hotel booking system for my computing a-level coursework, and have hit a stumbling block (doesn't help having a migraine either!)
I'm in the process of checking if a room is available for then the user to book (the application is all run and used by staff by the way) but trying to get my head around how to do it.
At the moment I was thinking I could just search the current booking database for the room number and dates I want to book for and if a match came back that meant that certain room was booked. That's all fine and dandy, but how do I tell it the range of dates? (sorry bad question) I was thinking an pseudo code version of the sql statement on the lines of:
If 'check in date of booking already on the database' is before 'check in date of new booking' AND 'check out date of booking already on the database' is after 'check in date of new booking' then room is already booked.
Basically if it returns a record then I know that room is booked. But I just need to figure out how to use SQL to search for records based on my check in/out dates.
But that'll allow double bookings, agh it's driving me mad :/ Any ideas?