Basically I've made a simple table full of 20 answers from radio buttons
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];
$q3 = $_POST['q3'];
and so on I wish to compare these values and give a percentage then show the most highest result to the lowest any ideas on the theory?
Comparing Answers between users
Re: Comparing Answers between users
Well you are presumably storing 1 and 0, You could get the number of 1 answers and compare it to the total.
Try it out and see how far you can get.
SELECT COUNT(`q1`) AS `q1` FROM `table` GROUP BY `q1`This would give you the number of yes and no resonances.
Try it out and see how far you can get.
Re: Comparing Answers between users
Off-topic, you could do this:
$count = 20; for($i = 1; $i <= 20; $i++){ $q{$i} = $_POST["q{$i}"]; }Then you have all your $q1, $q2, $q3 (etc..) ready to be used