try moving the defined variables above the compare code:
PHP Code:
$gscore = 4;
$hscore = 3;
$rscore = 2;
$sscore = 1;
if ($answer == $ganswer){
$score = $gscore;
} elseif ($answer == $sanswer){
$score = $sscore;
} elseif ($answer == $hanswer){
$score = $hscore;
} else {
$score = $rscore;
}
if ($bbuserinfo['usergroupid'] == 2){
$DB_site->query("UPDATE user SET question1 = '"
.$theqid
."', score1 = '"
.$score ."'
WHERE userid = '"
.$bbuserinfo[userid]."'");
}
and then add this to just below the compare code to see what is contained in $score.
so it would end up looking like this:
PHP Code:
$gscore = 4;
$hscore = 3;
$rscore = 2;
$sscore = 1;
if ($answer == $ganswer){
$score = $gscore;
} elseif ($answer == $sanswer){
$score = $sscore;
} elseif ($answer == $hanswer){
$score = $hscore;
} else {
$score = $rscore;
}
echo $score;
if ($bbuserinfo['usergroupid'] == 2){
$DB_site->query("UPDATE user SET question1 = '"
.$theqid
."', score1 = '"
.$score ."'
WHERE userid = '"
.$bbuserinfo[userid]."'");
}