Location: PHPKode > projects > E2Exam: LAMP for the Education > 3.php
<html>

<head>
<title>New Page 1</title>
</head>

<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">

<?
require("db.php");
#select all unanswered qid
$sql = "select q.QID from Questions q";
$res = mysql_query($sql);
while($r=mysql_fetch_array($res)){
	$qid_arr[]=$r['QID'];
}?>
<tr>
    <td>$qid_arr[]</td>
    <? while(list($qid)=array_values($qid_arr)){ ?>
    <td>&nbsp;<?=$qid?></td>
    <? }?>
  </tr>
<?
$sql = "select distinct e.QID from ExamAnswers e";
$sql .= " where e.EID='babalu'";
$res = mysql_query($sql);
while($r=mysql_fetch_array($res)){
	$ques_ry[]=$r['QID'];
}?>
<tr>
    <td>$ques_ry[]</td>
    <? while(list($qid)=each($ques_ry)){ ?>
    <td>&nbsp;<?=$qid?></td>
    <? } ?>
  </tr>
<?
$qid_array = array_diff($qid_arr,$ques_ry);
$quesid = array_rand($qid_array);
?>
<tr>
    <td>$qid_array[]</td>
    <? while(list($qid)=each($qid_array)){ ?>
    <td>&nbsp;<?=$qid?></td>
    <? } ?>
  </tr>

</table>
<? echo $quesid; 
mysql_free_result($res)?>
</body>

</html>
Return current item: E2Exam: LAMP for the Education