query($SQL); //echo $SQL; if (!$retid) { echo( mysql_error()); } $answerList="e,c,d,d,d,b,c,b,c,e,e,c,d,b,b,d,b,b,e,d,d,d,e,d,c,e,c,b,c,c,d,b,c,e,c"; $answerList="a,a,d,c,a,a,d,d,c,d,a,b,c,d,b,c,b,a,d,e,d,c,b,d,e,c,b,c,a,e,c,e,c,e,d"; $answerList="a,a,d,c,a,a,d,d,c,d,a,b,c,d,b,c,b,d,c,b,d,e,c,b,c,a,e,c,e,c,e,d";//removed 18-20 $answers=explode(",",$answerList); $wrong=array(); while ($row = $retid->fetch_assoc()) { $fname = $row["fname"]; $lname = $row["lname"]; $id=$row["id"]; if ($id!=9999) { $count++; $SQL3 = " SELECT * FROM my_quizzes"; $SQL3 = $SQL3 . " WHERE id = '$id' AND quiz='$test'"; //echo $SQL3; $retid3 = $mysqli->query($SQL3); $row3 = $retid3->fetch_assoc(); //echo $SQL3; if ($row3) { $comment= ($row3["answers"]); $userAnswers=explode(",",$comment); //echo "$comment

"; foreach($answers as $key=>$a) { if ($a!=$userAnswers[$key]) $wrong[$key]++; } } } } ksort ($wrong); foreach($wrong as $key=>$val) { if ($key<18) echo ($key+1) . ":" . $val . " - ". round(($val/$count)*100). "%
"; else echo ($key+9) . ":" . $val . " - ". round(($val/$count)*100). "%
"; } class Question { var $wrong; var $num; } ?>