Home > Archive > PHP SQL > October 2005 > best method. dates
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
best method. dates
|
|
| not_on@dummyaddress.com 2005-10-30, 6:58 pm |
|
I have X amount of hotel rooms stored in hotel table. mutiple hotels
each with mutiple rooms so hundreds of entries.
I need to store booking dates for every room with one year in advance.
I am trying to get my head around best method
Each room with 365 columns?
or
365 columns witha list of rooms booked that date.. hmm mebbe not
or
TEXT collumn in theroom table. this holds a list of dates stored as
such 4,67,85,199,345 each number= a day of year .. then I can split
the string (PHP) and plonk into online calander. One text field for
each room rather than 365 columns multiplied by number of rooms.
Any other ideas or best practice.. advice? :)
| |
| ZeldorBlat 2005-10-30, 6:58 pm |
| Presumably you have something like this:
create table hotel (
hotel_id int not null
....
)
create table room (
room_id int not null
hotel_id int not null
....
)
Then create a table to store the bookings. Something like this:
create table booking (
room_id int not null,
bookingDate smalldatetime
)
The primary key for this table should be (room_id, bookingDate). If
there is a row for a given room and date, then it's booked on that
date. Otherwise it isn't.
|
|
|
|
|