• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

Creating an online examination page to be created using PHP

I'm developing online examination web page to be created in PHP and MySQL. It would be a multiple choice exam. All the questions will be getting from the database and the answer choices will also be getting from the database.

For every exam, there will be 100 questions, and it will be divided into 20 questions per page.

So i've been planning in my business logic, upon starting the exam, the page will now query for a random questions for exactly 100 questions.

What do you think is the best way to store the questions? I dont know if SESSION is the Best way?
0
akirapimpim
Asked:
akirapimpim
  • 2
  • 2
1 Solution
 
rhyspCommented:
Are there more than 100 questions to choose from. I would set the system up to randomly assign 100 different questions to each student before the exam starts. E.g.
  Table - Answers
      question_id
      student_id
      answer

Obviously fill answer with Null as default.

To randomly pull 100 questions, do something like this:
   SELECT * FROM questions ORDER BY RAND() LIMIT 100;

You could then store the user's id in a session variable.
0
 
akirapimpimAuthor Commented:
Yes, thanks for the comment rhysp.

Correct me if I'm wrong, but what I understand to your suggestion is that, to the Table - Answer, before the exam, it will be populated by the question_id and the student_id and setting the answer to NULL for a total of 100 records since every exam is 100 items. Did I get it right?

0
 
rhyspCommented:
Yes. 100 records for each student.

It looks wasteful at first, but you will need those 100 records for each student after they've done the exam anyway. Essentially all your program would do then is let the student pick the answer to fill in all those NULL fields.
0
 
akirapimpimAuthor Commented:
Ok thanks for the help. I think this kind of solution will do. Thanks again.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now