I am trying to get my head around how to create a database properly that would allow hourly rental of equipment. I have the following tables in my database for reservations:
CREATE TABLE res (
res_id INT NOT NULL auto_increment,
res_equip_id INT DEFAULT NULL,
res_schedule_date DATE DEFAULT NULL,
PRIMARY KEY (res_id)
);
CREATE TABLE res_details (
res_details_id INT NOT NULL auto_increment,
res_id INT DEFAULT NULL,
cust_id INT DEFAULT NULL,
res_details_depart TIME DEFAULT NULL,
res_details_arrive TIME DEFAULT NULL,
res_details_comments VARCHAR(125) DEFAULT NULL,
PRIMARY KEY (res_details_id)
);
the res table ties the equipment to a particular day, and the res_details takes that equipment down to a certain time within a day, thus a particular piece of equipment could be rented several times within the same day.
I am just unsure if i am setting this up properly so that people could look at a particular week and be able to see when a piece of equipment is available on a given day.
Using PHP I want to display a 3 or 5 day grid at a time and show what hours the equipment is available.
If anybody has any pointers in the structure of the database I would greatly be appreciated.