U
Uncle Rico
Guest
I need to write a program for managing a meeting room.
Its a simple database consisting of one calendar table.
This "meeting_room" table consists of two fields, "date" (in MySQL date string format) and "booked" (boolean value - "T" if it is reserved for that date, "F" if it is still available for booking).
What is the MOST EFFICIENT way to calculate the NUMBER OF DAYS the room is INACTIVE both BEFORE and AFTER the new booking.
For example, if this were part of the table
12 Mar 2009 F
13 Mar 2009 T
14 Mar 2009 T
15 Mar 2009 F
16 Mar 2009 F
17 Mar 2009 F
18 Mar 2009 F
19 Mar 2009 F
20 Mar 2009 F
21 Mar 2009 T
If a user a requested a room booking for 19 Mar, how could I get PHP to calculate that there were 4 days prior when the room is vacant AND 1 day after when the room will be vacant?
It might be more efficient to use Unix date integer rather MySQL date string, but for the purpose of this exercise lets assume the later.
Needs some coding suggestions please.
Its a simple database consisting of one calendar table.
This "meeting_room" table consists of two fields, "date" (in MySQL date string format) and "booked" (boolean value - "T" if it is reserved for that date, "F" if it is still available for booking).
What is the MOST EFFICIENT way to calculate the NUMBER OF DAYS the room is INACTIVE both BEFORE and AFTER the new booking.
For example, if this were part of the table
12 Mar 2009 F
13 Mar 2009 T
14 Mar 2009 T
15 Mar 2009 F
16 Mar 2009 F
17 Mar 2009 F
18 Mar 2009 F
19 Mar 2009 F
20 Mar 2009 F
21 Mar 2009 T
If a user a requested a room booking for 19 Mar, how could I get PHP to calculate that there were 4 days prior when the room is vacant AND 1 day after when the room will be vacant?
It might be more efficient to use Unix date integer rather MySQL date string, but for the purpose of this exercise lets assume the later.
Needs some coding suggestions please.