Hello

I’m trying to create a simple facility booking system using PHP/MYSQL for a leisure centre as part of my final year project. I’ve been looking online for the best way to do this and I can’t find anything of use.

Does anyone have any idea what would be the best / easiest way to do this? I don’t have much experience using PHP/MySQL so don’t really know where to start. Any advice or help will be much appreciated.

Development platform aside, you want to start by understanding the domain you're trying to work in. In this case you would want to look at other booking systems and get an understanding of how the leisure center does business.

Once you have a good understanding of their processes, begin by modeling the domain. Define the entities and their attributes, as well as their relationship with each other.

e.g. You have a facility, which has rooms, maybe each room has a unique purpose or unique set of equipment. Maybe rooms can be combined via a foldable wall to create a compound room.

A facility could also have conditions for when it is available, such as monday - friday 8am - 5pm. So bookings should not be possible out of this window. Each room could have conditions such as a min/max number of users, certain membership level, etc.

A facility could also have employees, which have different levels of employment, manager, staff, trainer, etc. As well as also possibly having levels of membership such as bronze, silver, gold making it possible to reserve different sets of rooms or equipment.

etc. etc.

As your model becomes more refined your data will start to structure itself. So the next thing to do would be to define a data structure that works for your design. Once you have this designed and in place build the system to satisfy your modeling conditions.

This really lends itself to an object oriented design, but there is nothing stopping you from implementing this kind of thing in procedural code. Just be cautious as something that appears to be simple can get very complicated once you understand the design better.

As far as php/mysql usage. Use what you know and when you get stuck, google or come here and ask for help.

Member Avatar for diafol

> Does anyone have any idea what would be the best / easiest way to do this?

As you don't know much mysql/php. This is a toughie.

You need to get up to speed on relational databases - build tables so you can normalize data, build queries for inserting, selecting, deleting, updating records.

I'd also advise using reusable bits of code for similar functions. As ms stated, OOP would be the way to go, but if you're a beginner, this may prove too much of a learning curve. So, use functions as opposed to loads of just 'flat' php filled pages with replicated code everywhere. Again, this is easier said than done, until you're a bit more experienced.

This is a 'final year project'. Final year of high school, college?? What's the background - are you concentrating on design/accessibility with the server-side stuff being secondary, or are you set with creating a robust, secure fully-featured system, with lip service to design?

I once created a booking app for my school so we could book IT rooms during lessons. That was simple because a period is a period - no times to complicate things. A leisure centre will pose different problems as times may differ from room to room/facility to facility.

Spend plenty of time (again as ms said), in the planning stage thinking about everything the system needs to do and how you could go about achieving that. This project is all about data. How to store, manipulate and retrieve and display. You'll have quite a few related tables. How does the user interact with the app?

So for a trivial solution - this may be helpful. I haven't included everything - staff aren't included in other tables and activity classes may be timetabled to repeat between certain dates. In addition, how do you change activities depending on the day of the week. So, in fact, thinking about it, the nonsense below probably won't help you too much!

TABLES
members (member_id | firstname | surname ....)
staff (staff_id | firstname | surname ....)
rooms (room_id | room_name | description)
activities (activity_id | activity_name | description)
bookings (booking_id | member_id | art_id | paid) 
activity_room_times (art_id | activity_id | room_id | time_start | time_end | active) - this could be a template for you onscreen timetable

Anyway, jsut an idea

Thanks for the replies.

I'm trying to keep it as simple as possible, basically hour slots between certain times during the day. If the slot is taken it will show as unavilable.

It is part of a web site for a leisure centre, users will have to log in to use the booking facilities. There will also have to be an admin side so that staff can view bookings etc. Below is a rough guide of what i have gathered so far.

Fitness Instructor booking

This part of the site should allow logged in users to make appointments with a fitness instructor for a personal session.

3 different instructors available between the hours of 10am – 4pm. - 1 hour slots.

One Member to One Fitness Instructor in One Session

Once slot has been booked it should show as unavailable.

Tables
Tbl_member (mem_id, mem_title, mem_fname, mem_sname, mem_age, mem_address, mem_city_town, mem_p_code, mem_country, mem_email, mem_phone, mem_mob_phone)
Tbl_inst_booking (inst_booking_id, inst_id, mem_id, inst_booking_start, inst_booking_fin)
Tbl_instructor (inst_id, emp_id, inst_name, inst_available)
Tbl_employee (emp_id, emp_fname, emp_sname, emp_role, emp_contact)

Facility Booking

This part of the site should allow logged in users to book a facility.

Facilities below available between the hours of 9am – 6pm. – 1 hour slots

One member books one facility at any one time

Once slot has been booked it should show as unavailable.

Facilities available:

8 Courts - Main Hall 35m X 28m
2 Small Halls
4 Squash Courts

Tables
Tbl_member (mem_id, mem_title, mem_fname, mem_sname, mem_age, mem_address, mem_city_town, mem_p_code, mem_country, mem_email, mem_phone, mem_mob_phone)
Tbl_fac_booking (fac_booking_id, fac_id, mem_id, fac_booking_start, fac_booking_fin)
Tbl_facility (fac_id, mem_id, fac_name, fac_price)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.