I am working on creating a PHP/mysql quiz application. I outlined my table structure here:
MySql database design for a quiz program
Now I am looking for a way to automatically generate the actual quiz pages. Once I enter the corresponding data in the “quizzes” table, I want a page to be automatically created containing all the corresponding questions/answers with the same quiz ID. A link to this quiz would then be added to a list of all the quizzes somewhere.
Basically, I want everything to be automated once the data is entered in the mySQL tables.
All I can really think is that once each page is created for the quiz, I could use a while or for loop that identifies all the questions with the same ID as the quiz, and create those. Then another nested while/for loop that generates the matching answers for each question. As for creating actual each quiz page, I am a bit lost.
You have a single page (i.e.
quiz.php) and use GET variables to fetch the data you need.Don’t generate the pages beforehand, it’s usually over-complicated and redundant.