kwdelre Posted January 8, 2011 Share Posted January 8, 2011 Hey guys, I am building a quiz management system and have a few basic structure questions and need some advice. (I am using mysql and PHP) There will be approximately 15 quizzes with unlimited users. users will be able to review previous quizzes (or "track" quizzes) Should I: a) Create a database for each Quiz and then a table for each student that comes through; and gather all quiz data in this one specific table. b) Create one database. Create a table for each quiz and then make each row designate the student and results c) Something entirely different. I'm wondering which would be easier in the long run when there is 2,000 users. Thanks for your thoughts Quote Link to comment https://forums.phpfreaks.com/topic/223805-database-structure-question/ Share on other sites More sharing options...
joel24 Posted January 8, 2011 Share Posted January 8, 2011 You should have one database, and several tables, One for the quiz names, settings, etc One for quiz questions (linked to the quiz name with a quizID and identified with a questionID) One for users (login, password, name, email etc) One for usersQuestions which will list the attempted questions. This table would hold the questionID and the userID and the mark for that question. Primary keys questionID and userID, then use a INSERT ON DUPLICATE UPDATE query and if the user attempts to redo the question, this will update the row with the new mark rather than creating a new one, otherwise it will just insert a new row (for first attempts) Quote Link to comment https://forums.phpfreaks.com/topic/223805-database-structure-question/#findComment-1156837 Share on other sites More sharing options...
ignace Posted January 9, 2011 Share Posted January 9, 2011 It depends on the Quiz you are trying to make. If it's a typical Question and select from multiple possible Answers then a normal Question/Answer set-up will do. However, if you are after creating a Quiz that allows to make a Question but the Answer can be text as well as only a text input field then you will be required to go for a different approach. Quote Link to comment https://forums.phpfreaks.com/topic/223805-database-structure-question/#findComment-1156984 Share on other sites More sharing options...
kwdelre Posted January 10, 2011 Author Share Posted January 10, 2011 You should have one database, and several tables, One for the quiz names, settings, etc One for quiz questions (linked to the quiz name with a quizID and identified with a questionID) One for users (login, password, name, email etc) One for usersQuestions which will list the attempted questions. This table would hold the questionID and the userID and the mark for that question. Primary keys questionID and userID, then use a INSERT ON DUPLICATE UPDATE query and if the user attempts to redo the question, this will update the row with the new mark rather than creating a new one, otherwise it will just insert a new row (for first attempts) Thank you so much for the detailed answer. I think I see what you are thinking. I will give it a try. I'm learning most of php as I go. Do you know of any tutorials that are specific to quiz systems? I know there are ones out there that you can use pre-made, but I would really rather build this myself. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/223805-database-structure-question/#findComment-1157208 Share on other sites More sharing options...
joel24 Posted January 10, 2011 Share Posted January 10, 2011 haven't heard of any, though I'm sure google will source one for you. Quote Link to comment https://forums.phpfreaks.com/topic/223805-database-structure-question/#findComment-1157258 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.