Jump to content

General outline for comparing many values against one single set of values


galvin

Recommended Posts

I put this in wrong  forum, how do I move it? :(

 

I'm not asking anyone to write any code at all, just hoping someone could let me know if I'm headed in the right direction, in terms of a general outline IN PLAIN ENGLISH.

 

I have a pretty good grasp of PHP but I have never done anything this complicated before so I want to make sure I have the most efficient plan of attack before I delve in.

 

And the process seems complicated to me, but I assume some of you experts will laugh at me for thinking it's complicated :)

 

Anyway, here is the gist.  I have two tables that matter here...

 

GUESSES and RESULTS

 

Inside Guesses, there are about 10 category fields.  These fields get populated with guesses from website visitors.  All that is working fine (i.e. the guesses are getting entered into the guesses table fine).

 

RESULTS gets populated with one single set of the CORRECT, ACTUAL answers to each guess category.

 

So now what I have to do, is compare ALL the guesses in the GUESSES table to the correct answers in the RESULTS table. This would be easy if there was only one set of GUESSES, but there could be up to 50 different sets of guesses in the GUESSES table.

 

Also, scores will be calculated based on the accuracy of guesses and an ultimate winner will have the highest score.

 

My thinking is...

 

A.  Store the single set of correct answers from RESULTS in an array

B.  Loop through each set of GUESSES and run my code to compare

C.  While doing B.,  calculate their score and store their score in an array.

D.  When all looping is done, take the array that should now contain ALL scores and find the biggest number

E.  Run code to announce the winner and do whatever else I need.

 

Maybe you don't have enough info to answer this, but does this sound like the right way to do something like this?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.