Im new to PHP and I am building a booking app using PHP and HTML, I have a user registration page that saves user information to a table in a MySQL database when a user logs in, then can then go to a calendar to select a day, from there they can select a timeslot that saves to another table in my database. My problem is I'm struggling with the concept of how to link these two tables together so I can have the user and timeslot linked together.
It depends on the reason the user is selecting a time slot, and restrictions that apply to selecting a time slot.
I'm assuming this is some sort of organizer or planning application, and that users select a time slot so that they can make an appointment.
Can users have multiple appointments simultaneously? Is there any information associated with a time slot besides the starting time, duration and user that wants to reserve the time slot?
posted 1 month ago
The app is to allow a customer to book an appointment in a shop , at the moment I’m
Not allowing multiple appointments , I will be asking for some more information along with the time slot separate from the Information they used to register but if this prove to difficult I won’t
You need to remember the user, and you cannot trust anything time related. What you instead need to do is remember who the user is. There's a good mechanism for that - sessions. Basically:
* When you create the user, you store the user id in the session.
* When you want to create the time slot, you verify that there still is a session with the user id. If so you use it; if not you need to let the user start over.
The latter can occur for a few reasons. The most obvious ones are:
* People trying to skip the user registration page.
* The session expiring.