Jump to content

Recommended Posts

Hi there,

 

I'm new to both here and PHP / MySQL.

 

I have just bought a book on learning it and for my first project I am wanting to build a raffle / lotto script.

But, I'm stuck on the best way to design my database.

 

The database must store:

 

Unique generated random user/ customer ID

Name

Email

TEL

Ticket numbers (string of random generated numbers & letters)

total cost

date

paypal receipt number

 

now my problem is this..

 

How would I best store the ticket data?

 

I can create a table to store name, email, etc. It's when it comes to tickets i'm stuck.

If a user purchases one ticket thats fine its one field but if a user buys 10 tickets...

 

Could I build a 2 table system with one just for tickets and link the data by having a column for the customer id and one for tickets, then for every ticket purchased by the same person, their customer id is associated with that ticket string in the next field.

 

eg:

 

Table 1 - User & Order Info Etc

 

UserID
Cust1
Fname
Value
Lname
Value
Email
Value
Etc
Etc

 

Table 2 - UserID & Ticket Strings

 

UserID
Cust1
Cust1
[/td]
TicketID
ticket string 1
ticket string 2
[/tr][/table][/td][/tr][/table]

 

would that work?

 

 

Link to comment
https://forums.phpfreaks.com/topic/86786-solved-database-help-concept-stages/
Share on other sites

Certainly the 2 tables

 

[pre]

Customer            Ticket

----------          ----------

CustID  ----+      ticketNo

Fname        +----- CustId

Lname              date

Email              paypal_receipt_number

etc

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.