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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:02:08+00:00 2026-05-27T17:02:08+00:00

In one of my web application in php there is a contest section .

  • 0

In one of my web application in php there is a contest section . It contains a multiple choice 10 questions , Each has 4 options .

After user filling the form I am saving the answer as comma separated values in a db . like follows:

user   |    answer
-------------------------------------
112    |  1,7,8,9,8,5,2,3,6,7,9,6

I got a answer key same as the use’s filled answer key ..

What is the best logical method for evaluate the users input and find out the highest scored user?

  • 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-27T17:02:09+00:00Added an answer on May 27, 2026 at 5:02 pm

    As mentioned in the comments, this isn’t the best way to store data, but I’d evaluate like this:

    $query = mysql_query("select * from `table` where 1",CONNECTION_IDENTIFIER) or die("die message");
     $answer_key = array(answer1,answer2,etc);
     $high_score = 0;
     $high_scorer= "";
     while($r=mysql_fetch_array($query)){
        $users_answers = explode(',',$r['answer']);
        $user_score = 0;
        for($i=0;$i<10;$i++){
            if ($answer_key[$i]==$users_answers[$i]){
                $user_score++;
            }
        }
         if ($user_score > $high_score){
                $high_score =  $user_score;
                $high_scorer = $r['user'];
         }
     }
    
     echo "High scorer is $high_scorer with $high_score points";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an web application using php. One of the requirement is the
I've been taken onboard to work on a PHP-based web application. One part of
I'm working on a solution that has two projects: One ASP.NET web application, and
I am developing one PHP web application, I want to provide more security to
I've developed a web application in PHP and MySQL. One part of the system
I recently deploy one web application in one of my development servers. I'm using
We have one web application (sharepoint) that collects information from disparate sources. We would
I'm running single instance CloudFoundry configuration with one web application. I turned on Hyperic
I have a one page web application, which means alot of javascript. External scripts
I have one asp.net web application. It is using two membership provider. Two sign-in

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.