headmine Posted April 10, 2009 Share Posted April 10, 2009 I am building a website that does the following. User signs up via sign up form and that info is put into a database table. We can call the table Clients. Once they sign up they are prompted to pay for the services. Once they pay via paypal. The info is sent to a script that uses paypal IPN. On successful payment the script updates the database with a temp generated password and sets the field active to "TRUE" and then emails the user their temp password. This all works. The next part is where my question comes in... The services that are provided involve the user filling out info and submitting it to the database and then later being able to print it out. There are two sections that they need to fill out. Section 1 we will call Basic Questions. Section 2 we will call Analysis. My Question is what is the best practice for this? Should I create a separate tables that will collect info for Section 1 and Section 2 (for a total of 3 tables including clients) OR Should I just add the fields that are needed to the current table "clients" that collects the initial sign up info? If the answer is option 1 when the user signs up I just need to create a script that will create a new field in the database table "Basic Questions" and "Analysis" with an identifier like ID right? So that all 3 tables have the same ID? Am I far off? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/153538-php-mysql-advice/ Share on other sites More sharing options...
revraz Posted April 10, 2009 Share Posted April 10, 2009 Depends on how the information is related. Is it simple answers to simple questions? I would just have a answer table and store the user id along with the answers. Quote Link to comment https://forums.phpfreaks.com/topic/153538-php-mysql-advice/#findComment-806786 Share on other sites More sharing options...
laffin Posted April 10, 2009 Share Posted April 10, 2009 I wud prefer option 1 Even better is if u can store the questions into a table and the test names into another table This way, u can add more tests / questions. Of course u would have to devise a way of saying which questions are of which type bool (yes/No, True/False) Single Anser options Multiple choice essay But that gets its own complexities. But in the end shud prove very flexible. Quote Link to comment https://forums.phpfreaks.com/topic/153538-php-mysql-advice/#findComment-806787 Share on other sites More sharing options...
headmine Posted April 10, 2009 Author Share Posted April 10, 2009 So maybe just 2 total tables? Table1 = 'Clients' stores initial sign up info. Ex. Name, Email, Address, username etc. Table2 - 'Answers' stores answers to questions asked in Basic Questions and Analysis The questions asked in both sections should produce different data. Sometimes numeric sometimes alpha numeric. Quote Link to comment https://forums.phpfreaks.com/topic/153538-php-mysql-advice/#findComment-806813 Share on other sites More sharing options...
Mchl Posted April 10, 2009 Share Posted April 10, 2009 You would probably still need a table for questions themselves if you want to add new ones easily. Take a look at this: http://www.phpfreaks.com/forums/index.php/topic,126097.0.html (the very first link is great) Quote Link to comment https://forums.phpfreaks.com/topic/153538-php-mysql-advice/#findComment-806823 Share on other sites More sharing options...
headmine Posted April 10, 2009 Author Share Posted April 10, 2009 Awesome! Thank you Quote Link to comment https://forums.phpfreaks.com/topic/153538-php-mysql-advice/#findComment-806824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.