<html>
<?
require("db.php");
?>
<head>
<title>Frequency Distribution</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#008080" id="AutoNumber1">
<tr>
<td colspan="3" align="center" style="color: #FFFFFF; font-family: Tahoma; font-size: 14pt; font-weight: bold; background-color: #008080">
Frequency Distribution</td>
</tr>
<?
#while question
$sql = "select * from Questions order by QID";
$res = mysql_query($sql);
while($q=mysql_fetch_array($res)){
$c1 = " ";
$c2 = " ";
$ss = "select a.ANS from Answers a,Questions q where a.ANS=q.C1 and a.QID=q.QID and a.QID=".$q['QID'];
if($r1=mysql_query($ss)){
$n1 = mysql_num_rows($r1);
if($n1==1){
$c1 = " background-color:#c0c0c0; ";
}
}
$ss = "select a.ANS from Answers a,Questions q where a.ANS=q.C2 and a.QID=q.QID and a.QID=".$q['QID'];
if($r1=mysql_query($ss)){
$n1 = mysql_num_rows($r1);
if($n1==1){
$c2 = " background-color:#c0c0c0; ";
}
}
$ss = "select e.EID from ExamAnswers e,Questions q";
$ss .= " where e.QID=q.QID and q.C1=e.ANS and e.QID=".$q['QID'];
if($r1=mysql_query($ss)){
$n1 = mysql_num_rows($r1);
}
$ss = "select e.EID from ExamAnswers e,Questions q";
$ss .= " where e.QID=q.QID and q.C2=e.ANS and e.QID=".$q['QID'];
if($r1=mysql_query($ss)){
$n2 = mysql_num_rows($r1);
}
?>
<tr>
<td colspan="3" style="font-family: Tahoma; font-size: 10pt; color:#000080; background-color:#e0e0e0" valign="top">
<b><?=$q['QID']?></b>: <?=$q['Question']?></td>
</tr>
<tr>
<td width="30" style="font-family: Tahoma; font-size: 10pt" valign="top"> </td>
<td style="font-family: Tahoma;<?=$c1?> font-size: 10pt" valign="top" width="200">A
. <?=$q['C1']?></td>
<td width="100" align="right" style="font-family: Tahoma;<?=$c1?> font-size: 10pt" valign="top"><?=number_format($n1)?> </td>
</tr>
<tr>
<td width="30" style="font-family: Tahoma; font-size: 10pt" valign="top"> </td>
<td style="font-family: Tahoma;<?=$c2?> font-size: 10pt" valign="top" width="200">B
. <?=$q['C2']?></td>
<td width="100" align="right" style="font-family: Tahoma;<?=$c2?> font-size: 10pt" valign="top"><?=number_format($n2)?> </td>
</tr>
<?
}
#e question
?>
<tr>
<td style="font-family: Tahoma; font-size: 10pt" valign="top"> </td>
<td style="font-family: Tahoma; font-size: 10pt" valign="top"> </td>
<td width="100" style="font-family: Tahoma; font-size: 10pt" valign="top"> </td>
</tr>
</table>
</body>
</html>