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 8936805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:17:47+00:00 2026-06-15T10:17:47+00:00

I am trying to make a quiz and am using the following to compare

  • 0

I am trying to make a quiz and am using the following to compare the results, it seems to work and outputs once but that’s all it does, I don’t get any more records processed even though there are two question in the quiz, so it should be outputting correct, correct or correct, incorrect etc.

          <?php
    // Make a MySQL Connection
    // Construct our join query
    $query = "SELECT * FROM itsnb_chronoforms_data_answerquiz a, itsnb_chronoforms_data_createquestions
    q WHERE a.quizID='$quizID' AND a.userID='$userID' and q.quizID=a.quizID and
    a.quizselectanswer = q.correctanswer" or die("MySQL ERROR: ".mysql_error());

    $result = mysql_query($query) or die(mysql_error());


    // Print out the contents of each row into a table 
    while($row = mysql_fetch_array($result)){
        if ($row['correctanswer'] == $row['quizselectanswer']){
            echo 'CORRECT';}
            else { echo 'INCORRECT';
            }

        echo "<br />";
    }
    ?>

EDIT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Table structures as follows >>

itsnb_chronoforms_data_answerquiz
cf_id , cf_uid , cf_created , cf_modified , cf_ipaddress, cf_user_id, questionID, quizselectanswer ,quizID ,userID

itsnb_chronoforms_data_createquestions
cf_id ,cf_uid,cf_created ,cf_modified, cf_ipaddress, cf_user_id, quizID, questionID, quizquestion, quizanswer1, quizanswer2, quizanswer3, quizanswer4, questionformat ,correctanswer

  • 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-06-15T10:17:48+00:00Added an answer on June 15, 2026 at 10:17 am

    You are getting four answers when removing the selectanswer=correctanswer condition (which is indeed not what you want, since you want to fetch both correct and incorrect answers) because you don’t relate the answer ids.

    $query = "SELECT * FROM itsnb_chronoforms_data_answerquiz a, itsnb_chronoforms_data_createquestions
    q WHERE a.quizID='$quizID' AND a.userID='$userID' and q.quizID=a.quizID and
    a.quizselectanswer = q.correctanswer" or die("MySQL ERROR: ".mysql_error());
    

    should be:

    $query = "SELECT * FROM itsnb_chronoforms_data_answerquiz a, itsnb_chronoforms_data_createquestions
    q WHERE a.quizID='$quizID' AND a.userID='$userID' and q.quizID=a.quizID and
    a.questionID = q.questionID" or die("MySQL ERROR: ".mysql_error());
    

    You were getting a cross product of questionIDs without that condition. The four records you were seeing being (if the questionIDs are 1 and 2):

    1. a.questionID=1 and q.questionID=1
    2. a.questionID=1 and q.questionID=2 (don’t want this)
    3. a.questionID=2 and q.questionID=1 (or this)
    4. a.questionID=2 and q.questionID=2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to make multiple quizes that will keep track of each quiz on
im trying make one replace in string from a array but this dont work
I am trying to work my head round this, I am using the following
I'm trying make a function that lists all subkeys of a specific (windows registry)
I am trying to make a quiz that should show questions not answered before
Good day. I'm trying to make an online quiz application using php. The idea
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
I am trying to make a quiz using PHP and Mysql. I have create
I am trying make a UIView fullscreen but the problem is my view does
I'm trying make it work. And I have a lot of errors, but this

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.