Creating an online examination page to be created using PHP

Posted on 2007-07-24
Last Modified: 2012-08-14
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?
Question by:akirapimpim
    LVL 5

    Expert Comment

    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

    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.

    Author Comment

    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?

    LVL 5

    Accepted Solution

    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.

    Author Comment

    Ok thanks for the help. I think this kind of solution will do. Thanks again.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Write an app 9 38
    When to use $_SERVER["REQUEST_URI"] and why? 3 27
    Amazon Product image url. 12 28
    Post a good COM tutorial 1 21
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now