• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Connecting user data

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 12008
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Johnny Quinn
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 21949
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Johnny Quinn
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That make sense , thanks for that
 
Rob Spoor
Sheriff
Posts: 21949
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.

Btw, I only now see I said that you need to remember the user twice. Guess it's that important
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic