Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7641769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:00:34+00:00 2026-05-31T09:00:34+00:00

P.S. I am new to php & webform scripting; Currently I have the following

  • 0

P.S. I am new to php & webform scripting;

Currently I have the following multiple choice question table inside MySQL database :

     |MCQ_ID|Question|Opt_1|Opt_2|Opt_3|Opt_4|Opt_5|
     |1|What is the port|23|21|22|80|53

My objective is to create a quiz in a web form, using php scripting where
(1) The Questions are selected from the database & displayed in a multiple choice form with only a single answer to each question
(2) Each webform should display only one question as there will be a timer to record the amount of time spend at a particular question.

Below is my begining script & how should I go from here to achieve my above objectives?

 <!DOCTYPE html>
    <html>
        <head>
            <style type='text/css'>
                #wrapper {
                    width:950px;
                    height:auto;
                    padding: 13px;
                    margin-right: auto;
                    margin-left: auto;
                    background-color: #fff;
                }
            </style>
        </head>
        <body bgcolor="#e1e1e1">
            <div id="wrapper">
                <center><font fact="Andalus" size="5">Test Quiz</font></center>
                <br /><br /><br /><br />
            </div>

            <?php
                //Start Variables
                $username   =   "root";
                $password   =   "";
                $database   =   "Test";
                //End Variables

                //Connect To Database
                $link   =   mysql_connect(localhost,$username,$password) or die ('Could not connect :'.  mysql_error());
                mysql_select_db($database) or die( "Unable to select database");

                //SQL Get Questions
                $query  =   "SELECT * FROM MCQuestionBank";
                $result =   mysql_query($query) or die ('Query failed:'. mysql_error());
                $row    =   mysql_fetch_array($result,MYSQLI_ASSOC);

                //Get results
                /*
                while ($row = mysql_fetch_array($result,MYSQLI_ASSOC))
                    {
                        echo '<br> QuestionName : ' .$row{'Question'} ;
                        echo '<br> Option 1 : ' .$row{'MCQ_Opt1'};
                        echo '<br> Option 2 : ' .$row{'MCQ_Opt2'};
                        echo '<br> Option 3 : ' .$row{'MCQ_Opt3'};
                        echo '<br> Option 4 : ' .$row{'MCQ_Opt4'};
                        echo '<br> Option 5 : ' .$row{'MCQ_Opt5'};
                    }
                */
                mysql_free_result($result); 
                mysql_close($link);
            ?>
        </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:00:35+00:00Added an answer on May 31, 2026 at 9:00 am

    That table structure is going to be unmanageable. If you’re going to use a database you need to normalize it. Questions go in one table. Answers in another. That way is much more flexible. What are you are going to do when, for example, a question needs to have more (or less than) 5 choices?

    Get some general background on relational databases and then come back to the problem. This might be a good start:

    http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelationalDatabaseDesign.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's set the stage, PHP & MYSQL: I have a table we'll call Directions
I have think this question few month for my .NET project (winform & webform)
I'm new to jQuery, familiar with PHP & CSS. I have nested, dynamically generated
I am very new to PHP and MySQL and I have some questions. First,
I am new to PHP and trying to get the following code to work:
I am pretty new to php, but I am learning! I have a simple
I'm new to PHP and have installed on Linux to boot (also a newbie).
I'm basically a front end designer and new to PHP and MySQL but I
I'm new to PHP (and web development in general) and have come across something
I'm creating a multi-user/company web application in PHP & MySQL. I'm interested to know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.