Trying to create an online booking system using PHP/MySQL in Dreamweaver

Associate
Joined
3 Nov 2002
Posts
281
I'm creating an online booking system for IT equipment using PHP/MySQL in Dreamweaver.

So far I have a user registration page, login page, admin login page, admin management pages such as add/edit users and equipment. They are all working fine with the database.

It's now time for me to create the booking system - however I've spent a lot of time looking at tutorials on the internet and I'm not sure when to start. I want to be able to display equipment that is available with users having the ability to book equipment for a specified period of time with that equipment then becoming unavailable to other users for that period.

Could anyone give me any advice to start?

Cheers
 
Associate
Joined
26 Sep 2007
Posts
1,252
Location
Amsterdam
Seeing as it will be a many - many relationship between your Users and Equipment you'll want a join table which you could call Booking. The fields I'd use (without knowing the requirements for the system):
id(int)
user_id(int)
equipment_id(int)
start(datetime)
finish(datetime)

From this I guess there are two approaches, you can either have a boolean in your Equipment table to represent it being on loan or not which is incremented/decremented everytime it is booked and then handed back in.

Or you could have a 'completed' boolean in your Booking table which once the rent date expires and the equipment is handed back in you could increment.

You could check to see if equipment is available by doing a find on your equipment which joins to your bookings table only looking for equipment with bookings where completed = true. If one booking relating to that item isn't completed, it is still on loan and therefore unavailable.

Make sure to do validation checks in your book/hand in methods to ensure an item is not already booked/hasn't been booked.

There is probably a better way to do this but this is how I would for simplicity!
 
Associate
OP
Joined
3 Nov 2002
Posts
281
Thanks a lot for the info, that has given me a better understanding of what I need to do. Simplicity is what I am after certainly as I do not have the depth of knowledge to create anything more complicated at the minute.

Cheers
 
Back
Top Bottom