i want to save the score detail in php to db
var mins
var secs;
function cd() {
mins = 1 * m("5"); // change minutes here
secs = 0 + s(":01");
redo();
}
function m(obj) {
for(var i = 0; i < obj.length; i++) {
if(obj.substring(i, i + 1) == ":")
break;
}
return(obj.substring(0, i));
}
function s(obj) {
for(var i = 0; i < obj.length; i++) {
if(obj.substring(i, i + 1) == ":")
break;
}
return(obj.substring(i + 1, obj.length));
}
function dis(mins,secs) {
var disp;
if(mins <= 9) {
disp = " 0";
} else {
disp = " ";
}
disp += mins + " .";
if(secs <= 9) {
disp += "0" + secs;
} else {
disp += secs;
}
return(disp);
}
function redo() {
secs--;
if(secs == -1) {
secs = 59;
mins--;
}
document.cd.disp.value = dis(mins,secs); // setup additional displays here.
if((mins == 0) && (secs == 0)) {
window.alert(" Hey Time is up. Press OK to continue.");
window.location = "test.php" // redirects to specified page once timer ends and ok button is pressed
} else {
cd = setTimeout("redo()",1000);
}
}
function init() {
cd();
}
window.onload = init;
";
echo "Total Question Attempt",$tq,"";
echo "Correct Answer",$rans,"";
echo "Wrong Answer",$tq-$rans,"";
echo "Correct Answer Percentage",$rans/$tq*100,"%";
echo "Wrong Answer Percenntage",($tq-$rans)/$tq*100,"%";
echo "
"; $query="select * from quiz where qid<='$end' and qid>='$startposition'"; echo ""; echo ""; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
";
echo "";
echo "
i want to store the total question attempted $tq,right answer rans ,wrong answer in the db and i also retrieve the score.
Remaining Time: Minutes |
"; $query="select * from quiz where qid<='$end' and qid>='$startposition'"; echo ""; echo ""; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
Online Quiz Test Question | ||||
---|---|---|---|---|
",$row[0]," | ",$row[1]," | |||
A. ",$row[2]," | B. ",$row[3]," | |||
C. ",$row[4]," | D. ",$row[5]," | |||
Correct option is ",strtoupper($row[6])," | ||||
";
}
?>
";
echo "";
}
echo "";
?>
",$row[0]," | ",$row[1]," | ||
",$row[2]," | ",$row[3]," | ||
",$row[4]," | ",$row[5]," | ||
"; echo " | |||
"; $query="select woptcode from quiz where qid='$qid'"; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { if(strcmp($row[0],$useropt)==0) { echo ""; $rans=$rans+1; } else echo ""; } echo " |
2013 Unicorn Institute Of Technology. All rights reserved.