query($SQL); //echo $SQL; //echo $SQL; if (!$retid) { echo( mysql_error()); } //"44552123132225254334542442321141"; $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="44532123132225254334542442321141"; //test1 $answerList="31214344142342313325413215";//test2 $answerList="1111254224123";//test 3 $answerList="114542313255414152";//test 4 $answerList=array('e','e','a','a','b','c','b','d','d','e','e','d','c','b','c','d','e','c','a','b','b'); //test1 $answerList=array('c','b','a','c','d','b','c','a','a','c','d','e','d','b','a','d','a','c','d','b','c');//test2 $answerList=array('b','b','b','a','e','a','a','b','e','b','b','a','d','a','a'); //test3 $answerList=array('b','d','d','c','b','b','a','c','d','e','c','c','d','c'); //test4-19 $answerList=array('a','a','d','c','a','a','d','d','c','d','a','b','c','d','b','d','c','b','d','e','c','b','c','a','e','c','e','c','e','d'); //apjava //"44532123132225254334542442321141"; //$answerList="24234344142342313325413254"; //test2 //$answerList="245234325344142342313325413254"; //$answerList="312151514124221412341"; //$answerList="312151514124221412341"; //$answerList="33111141344135231341"; //$answerList="3311141344135243543"; // $answerList="ccaaaadacddacebcacda"; //$answerList="ccaaaadacddacebcacda";//t4 33111141344135231341 //$answers=explode(",",$answerList); //$answers=str_split($answerList,1); $answers=$answerList; $wrong=array(); for ($i=0;$i<13;$i++) $wrong[$i]=0; 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' AND time>'2017-01-12 08:21:02' ORDER by time ASC"; //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) { //echo "$key and $a ". $userAnswers[$key] . " ~"; if ($a!=$userAnswers[$key]) $wrong[$key]++; } } } } ksort ($wrong); foreach($wrong as $key=>$val) { if ($key<15) echo ($key+1) . ":" . $val . " - ". round(($val/$count)*100). "% " .convertLetter($answers[$key]).$answerList[$key]."
"; else echo ($key+11) . ":" . $val . " - ". round(($val/$count)*100). "%".$answerList[$key]."
"; } class Question { var $wrong; var $num; } function convertLetter($a){ if (true)return ""; switch($a){ case "1": return "a"; break; case "2": return "b"; break; case "3": return "c"; break; case "4": return "d"; break; case "5": return "e"; break; } } ?>