im using this code:
PHP Code:
if($_POST['ques']>1)
{
$fcorrectans= $DB_site->query("SELECT answer,answer_id FROM ".TABLE_PREFIX."quiz_answers WHERE question_id='".$_REQUEST['q']."' AND correct='1'");
while($correctanswer= $DB_site->fetch_array($fcorrectans))
{
if($_POST['ans']==$correctanswer['answer_id'])
{
$correct="1";
}
else
{
$correct="";
}
exec_switch_bg();
eval('$correctansbits .= "' . fetch_template('quiz_correctansbits') . '";');
}
$useranswer= $DB_site->query_first("SELECT answer FROM ".TABLE_PREFIX."quiz_answers WHERE answer_id='".$_POST[ans]."'");
eval('$correctans = "' . fetch_template('quiz_correctans') . '";');
}
it returns correct as 1 if the answer user selected equals the databases answer but since there are multiple answers the second answer shows correct as nothing aka false so it overwrites the first correct. any one know how to avoid this?