weasel2006 Posted January 19, 2008 Share Posted January 19, 2008 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 UserIDCust1 FnameValue LnameValue EmailValue EtcEtc Table 2 - UserID & Ticket Strings UserIDCust1Cust1[/td]TicketIDticket string 1ticket 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 More sharing options...
weasel2006 Posted January 19, 2008 Author Share Posted January 19, 2008 Table 2 - UserID & Ticket Strings CustIDCust1Cust1 TicketStringTicketString1TicketString2 Had to repost table 2 since there is a limit to the time I can modify my post :S Link to comment https://forums.phpfreaks.com/topic/86786-solved-database-help-concept-stages/#findComment-443598 Share on other sites More sharing options...
weasel2006 Posted January 20, 2008 Author Share Posted January 20, 2008 I'll asume that no one here knows how to design and build a database then. Thanks anyway Link to comment https://forums.phpfreaks.com/topic/86786-solved-database-help-concept-stages/#findComment-444209 Share on other sites More sharing options...
Barand Posted January 20, 2008 Share Posted January 20, 2008 Certainly the 2 tables [pre] Customer Ticket ---------- ---------- CustID ----+ ticketNo Fname +----- CustId Lname date Email paypal_receipt_number etc Link to comment https://forums.phpfreaks.com/topic/86786-solved-database-help-concept-stages/#findComment-444212 Share on other sites More sharing options...
weasel2006 Posted January 20, 2008 Author Share Posted January 20, 2008 Thanks Barand! I can start developing my DB Link to comment https://forums.phpfreaks.com/topic/86786-solved-database-help-concept-stages/#findComment-444252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.