gatez Posted December 9, 2007 Share Posted December 9, 2007 I am using php an msql i am using the min max so here is the idea This is how the algorithm works. Odd numbered questions (1,3,5 etc.) give points on the basis of answer 1 - one point, answer 2 - 2 point and so on. Even numbered questions (2,4,6 etc.) give points on the basis of answer 1 - five points, answer 2 - 4 points and so on. Then a percentage is calculated and the ratings table is looked up. so say i have 4 questions with 5 awnsers Q1. 1 point Q2. 2 points Q3. 5 points Q4. 3 points Total = 11 points Maximum possible points = 20 points (No. of questions=4) Percentage = 55.0% 11 divided by 20 x 100 = 55.0% min 40, max would be 60, ratings name would display rating from the database ok here is my problem say i have 4 questions with 5 awnsers and 4 ratings based on min- max percentages and the ratings tot he max of 100% how the heck do i set up the questions to have the proper awnsers considering the could pick any awnser such as awnser 1 4 2 3 rember the odd 12345 even 54321 numbers divided by the max witch is 20 x 100 im am lost and have been trying to figure this out all day Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted December 9, 2007 Share Posted December 9, 2007 I'm honestly confused just by reading your description. You need to post SOME code. Or at the very least write the code in plain words to see where you need to go from there. A few key items completely confused me. You said... Ok...this all makes sense here... Q1. 1 point Q2. 2 points Q3. 5 points Q4. 3 points Total = 11 points Maximum possible points = 20 points (No. of questions=4) Percentage = 55.0% 11 divided by 20 x 100 = 55.0% THEN you threw this in.. min 40, max would be 60 I have absolutely NO idea where you got 40 and 60 from. I looked at it every which way and never ever came up with those numbers. ratings name would display rating from the database What ratings name? WHAT database? ok here is my problem say i have 4 questions with 5 awnsers and 4 ratings based on min- max percentages and the ratings tot he max of 100% Again lost on this. Please clarify Quote Link to comment Share on other sites More sharing options...
gatez Posted December 9, 2007 Author Share Posted December 9, 2007 $answers = $_POST['answers']; $value = @array_sum($answers); $total = count($answers)*5; $value = @($value/$total)*100; $query = "SELECT * FROM ratings WHERE $value BETWEEN min AND max"; mysql_connect($mysql['host'],$mysql['user'],$mysql['pass']); @mysql_select_db($mysql['db']) or die( "Unable to select database"); $result = mysql_query($query); mysql_close(); $row = mysql_fetch_row($result); it pulls the awnsers from the database the table is called ratings and it uses min/max to find the awnser the problem i have is everyone awnsers a quiz different so i how the heck do you have proper awnsers for it Quote Link to comment Share on other sites More sharing options...
gatez Posted December 9, 2007 Author Share Posted December 9, 2007 anyone? Quote Link to comment Share on other sites More sharing options...
AndyB Posted December 9, 2007 Share Posted December 9, 2007 anyone? the problem i have is everyone awnsers a quiz different so i how the heck do you have proper awnsers for it I'd say your questions make no sense if that's the case. But since your method of scoring makes little apparent sense, maybe it balances out. Exactly what do you expect us to do, helpwise? Quote Link to comment Share on other sites More sharing options...
gatez Posted December 9, 2007 Author Share Posted December 9, 2007 Lol the question was just an example What is Your Ideal Lover? Your best friend as a child: Is still your best friend now. Was hilarious. Was the smart kid. Was imaginary. Ate paste. Your ideal lover works in: The entertainment industry. Finance. A nursing home. A band. And probably a restaurant. doctor When you come home after a long day, you want someone to say: I've missed you soooooo much! 'Welcome home. Now get naked.' 'Thank god you're home! Help!' 'Sit down. I'll massage the stress away.' 'What the hell do you want?' You want your first date to show up with: Flowers and chocolate. A bottle of red wine. A decent personality. A pizza, a six-pack, and a rented movie. condoms You're home sick. Your perfect lover: Brings you chicken soup. Prepares an elaborate homeopathic remedy. Watches TV in the next room and checks on you occasionally. Leaves. Nails you anyway. so see 5 questions with 5 awnsers depending on what the user checks will give them a different outcome based on the ratings how the heck do i set it up in the min max in msql Quote Link to comment Share on other sites More sharing options...
AndyB Posted December 9, 2007 Share Posted December 9, 2007 I have no idea what you're trying to accomplish. Since the 'right' answers for one person could be all first choices and the 'right' answers for the next person could be fifth choices, the concepts of rating, right, wrong, min, and max all have no meaning. For example, what the min and max of elephant, philosophy, uranium 235, Pittsburgh Steelers, and the square root of your grandmother's first name? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.