Page 1 of 1

Booking system- bookings per week

Posted: Tue Dec 09, 2008 9:51 am
by lynchpin
Hello,

I have browsed through the board but cant find anything similar to what I require.

I am building a booking system and I have multiple views, day/week/month for the booking calendar. I have been able to get the day view working, but now am stuck. I cant find a way to retrieve the bookings for a given week from my database.

I tried the following query:

------------------------------------------------------------------
select * from bookings where '2008-12-07 00:00:00' AND '2008-12-14 00:00:00' BETWEEN bookings.starting_date AND bookings.ending_date;
------------------------------------------------------------------

My bookings table has the following fields
------------------------------------
booking_id
user_id
subject
location
starting_date
ending_date
description
date
-----------------------------------

Thanks

Re: Booking system- bookings per week

Posted: Tue Dec 09, 2008 2:46 pm
by andym01480
Something like? SELECT * FROM bookings WHERE bookings.starting_date BETWEEN '2008-12-07 00:00:00' AND '2008-12-14 00:00:00' AND bookings.ending_date BETWEEN '2008-12-07 00:00:00' AND '2008-12-14 00:00:00' ;

Re: Booking system- bookings per week

Posted: Wed Dec 10, 2008 3:34 am
by lynchpin
The query still returns the same result as mine. :(