session_start(); $theuser1=$_SESSION["theuser1"]; include "../../dbsettings.php"; $test="test1-19"; $count=0; $SQL = " SELECT * FROM sch_students"; $SQL = $SQL . " WHERE class = 'apjava19' "; $SQL = $SQL . " order by 'showorder' "; $retid = $mysqli->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="44552123132225254334542442321141"; //test1 $answerList=array('A','D','E','C','E','A','D','A','A','B','B','E','E','E','A','E','E','A','E','C','D','B','C','B','A','D','B','A','D','D','D'); $answerList=array('d','e','d','c','d','d','d','d','a','d','b','c','d','b','a','b','d','d','d','e','d','d','e','a'); //test2 $answerList=array('z','e','a','c','e','b','c','a','c','d','e','c','b','d','c','a','b','e','c','c','a','d','a','c','c','c','e','c','c','b','b','e'); //test7-8 //$answerList="245234325344142342313325413254"; //$answerList=array('z','e','b','d','d','c','a','a','b','d','b','d','c','d','b','e','c','c','b','a','c','d','c','d','d','e','a','c','d','d','b','e'); $answerList=array('z','c','e','c','a','c','b','d','c','b','c','c','e','d','b','d','e','b','b','b','e','d','e','b','d','c','c','b','e','e','b','a','e','b','a','d','d','a','e','a','e' ); //2007 $answerList=array('z','b','c','b','e','b','a','b','b','b','d','a','e','c','d','b','d','c','d','b','a','c','b','a','d','a','d','b','d','d','e','e','a','c','d','d','b','a','b','c','a' );//2012 $answerList=array('e','e','a','a','b','c','b','d','d','e','e','d','c','b','c','d','e','c','a','b','b'); $answers=$answerList; //$answers=str_split($answerList,","); $wrong=array(); for ($i=0;$i<35;$i++) $wrong[$i]=0; while ($row = $retid->fetch_assoc()) { $fname = $row["fname"]; $lname = $row["lname"]; $id=$row["id"]; if ($id!=9999 && $lname!="Borland") { $count++; $SQL3 = " SELECT * FROM my_quizzes"; $SQL3 = $SQL3 . " WHERE id = '$id' AND quiz='$test' AND time>'2016-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"]); echo $comment; for ($i=33;$i>0;$i--) $comment=str_replace($i,",",$comment); $userAnswers=explode(",",$comment); //echo "$comment
";
foreach($answers as $key=>$a)
{
//echo "$key and $a & ". $userAnswers[$key] . " ~";
if (strcasecmp ($a,$userAnswers[$key])!=0)
{
$wrong[$key]++;
echo "$key and $a $id". $userAnswers[$key] . " ~";
}
}
}
}
}
ksort ($wrong);
$count--;
foreach($wrong as $key=>$val)
{
if ($key>0)
echo ($key) . ":" . $val . " - ". round(($val/$count)*100). "% " .convertLetter($answers[$key])."
";
}
class Question
{
var $wrong;
var $num;
}
function convertLetter($a){
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;
}
}
?>