Booking system- bookings per week

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lynchpin
Forum Commoner
Posts: 60
Joined: Mon Jul 21, 2008 1:31 pm

Booking system- bookings per week

Post 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
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Re: Booking system- bookings per week

Post 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' ;
lynchpin
Forum Commoner
Posts: 60
Joined: Mon Jul 21, 2008 1:31 pm

Re: Booking system- bookings per week

Post by lynchpin »

The query still returns the same result as mine. :(
Post Reply