Hey Guys,
I'm creating a scheduling system for my school that allows teachers to book rooms/vehicles. I'm just stuck on one aspect: populating the calendar. Basically, it'll have a month and week view. The monthly view I'm fine coding, but it's the weekly view I'm stuck on.
The people that are inserting bookings will be able to specify the date of the booking, and the block(s) of the day that it takes up. I could recurse through the days/blocks in the week, running queries on those days and seeing if something is booked at that time, but that would be WAY too inefficient.
My second idea was to get a timestamp for the first and last days of the week and then populate an associative array with all of those dates. Then I could recurse through the blocks of all the days and find any matches in the array. That's a bit better, but it still seems to inefficient for me.
Is there a better way of doing this?