Hi, i'm just new to this, was wondering if someone could help me out possibly...
I have a booking system im working on where you can book a time period, from one date (checkindate) to another (checkout), these are stored in a mysql db.
I've written sql (u can see it below)
SELECT COUNT(*) AS bookings_count
FROM hotel.bookings
WHERE RoomID = '$rooms'
AND DateCheckin <= '$id1'
AND DateCheckout >= '$id2'
id1 and id2 being date variables passed on from another page...
the trouble is the count result is = 0 when a checkindate prior to an already created checkindate is made and and a checkout date is made at a date after the record in the db for checkout..
its kinda confusing, just wondering if any1 has an idea, or if the between statement can be used? only issue i was wondering about with the between is if it can be between and = to at the same time..
anyway thanks in advance, hope someone can shed some light