Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Stratos's avatar
Level 14

Booking system can have guest OR user data. How to save in DB ?

So I don't know how to take this approach.. I have a booking system where I need to book a customer. The customer can have an account in our site or it could be a guest, anybody can make a book they just have to fill up the information.

I'm kind of lost as of what would the db schema be with this?

bookings table with user_id that would pull the user's data but what if it's a guest and not a user?

do I need a contact_data table? How do I make this relationship to work?

I'm open to any tips

0 likes
2 replies
pwerner's avatar

Maybe if they are a guest, after they fill out the form, you can generate a random string for a verification id. If they are a guest and need to check their booking later on, they'll have to use their verification id to get their data.

Snapey's avatar

If they book then they are a customer? Add them to the customer table before adding the booking?

Please or to participate in this conversation.