first thing first, you can embed php in html,
$result=mysql_query($sql);
$row = mysql_fetch_row($result);
$qid=$row[0];
$question=$row[1];
$answer1=$row[2];
$answer2=$row[3];
$answer3=$row[4];
$answer4=$row[5];
$rtanswer=$row[6];
?>
close, the php tags there only, and let html be displayed as html..
,
second thing, you are using mysqli in your database, either use pdo, for database fetch..
try that..