I have been putting a quiz together with jQuiz: http://www.fatihacet.com/lab/jQuiz/
If you take the test you will see it shows your score at the end in the format of 90/100 (it only has four questions).
How would you pass the score the user got to a variable to then perform a sql and IF statement?
in the jQuiz.js file it has the following code at the bottom:
$('.btnShowResult').click(function(){
$('#progress').width(300);
$('#progressKeeper').hide();
var results = jQuiz.checkAnswers();
var resultSet = '';
var trueCount = 0;
for (var i = 0, ii = results.length; i < ii; i++){
if (results[i] == true) trueCount++;
resultSet += '<div> Question ' + (i + 1) + ' is ' + results[i] + '</div>'
}
resultSet += '<div class="totalScore">Your total score is ' + trueCount * 20 + ' / 100</div>'
$('#resultKeeper').html(resultSet).show();
})
I tried
$Count = var results;
if($Count >= "90")
{
$award = $db->exec("UPDATE users SET test='passed' WHERE username='$username'");
}
I feel I have the right idea but am just missing something crucial as it is not working or doing anything. Thanks for any direction or help you can give me.