Location: PHPKode > projects > E2Exam: LAMP for the Education > scoreboard.php
<html>
<?
require("db.php");
?>
<head>
<title>Class ScoreBoard</title>
<style>
<!--
body         { font-size: 8pt; font-family: Tahoma }
-->
</style>
</head>

<body>

<div align="center">
  <center>
<?
$sql = "select distinct QID from Questions order by QID";
$res = mysql_query($sql);
$col = mysql_num_rows($res);
?>  
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border: 1px solid #000080; padding: 0" bordercolor="#111111">
    <tr>
      <td colspan="<?=$col+2?>" align="center" style="border:1px solid #000080; padding:0; font-size: 14pt; font-family: Tahoma; color: #000080; font-weight: bold">
      <?=$school?>:<?=$examtype?> - Class Scoreboard</td>
    </tr>
    <tr>
      <td align="center" style="border-style:solid; border-width:1; padding:0; font-size: 8pt; font-family: Tahoma; background-color:#CCCCCC">&nbsp;</td>
      <?
      while($r=mysql_fetch_array($res)){
      ?>
      <td align="center" style="border-style:solid; border-width:1; padding:0; font-size: 8pt; font-family: Tahoma; background-color:#CCCCCC">&nbsp;<?=$r['QID']?></td>
      <?
      }
      ?>
      <td align="center" style="border-style:solid; border-width:1; padding:0; font-size: 8pt; font-family: Tahoma; background-color:#CCCCCC">Score</td>
    </tr>
    <?
    mysql_free_result($res);
    $res2 = mysql_query("select EID from Examinee");
    $x=0;
    while($w=mysql_fetch_array($res2)){
    	$tot=0;
    	$x++;
    ?>
    <tr>
      <td style="border:1px solid #000080; padding:0; font-size: 8pt; font-family: Tahoma;<? if($x % 5==0) echo 'background-color:#CCCCCC';?>"><?=$w['EID']?>&nbsp;</td>
      	<?
      	$res=mysql_query($sql);
      	$y=0;
      	while($row=mysql_fetch_array($res)){
      		$cor=0;
      		$y++;
      		$q = "select e.ANS as An,s.ANS as Sn";
      		$q .= " from ExamAnswers e,Answers s";
      		$q .= " where e.QID=s.QID and e.EID='".$w['EID']."'";
      		$q .= " and e.QID=".$row['QID'];
      		if($res3=mysql_query($q)){
      			$ow = mysql_fetch_array($res3);
      			if($ow['An']==$ow['Sn']){
      				$cor=1;
      				$tot++;
      			}else{
      				$cor=0;
      			}
      		}else{
      			$cor=0;
      		}
      	?>
      <td align="center" style="border:1px solid #000080; padding:0; font-size: 8pt; font-family: Tahoma;<? if($x%5==0 || $y%10==0) echo 'background-color:#CCCCCC';?>">
      	<? if($cor==1){ ?>
      	<font face="Times New Roman">&#8730;</font>
      	<? }else{	?>
      	&nbsp;
      	<? } ?>
      	</td>
      	<?
      	} #while question
      	?>
      <td align="center" style="border:1px solid #000080; padding:0; font-size: 8pt; font-family: Tahoma;<? if($x%5==0) echo 'background-color:#CCCCCC';?>">&nbsp;<?=$tot?></td>
    </tr>
    <?
    } #while stud
    ?>
  </table>
  </center>
</div>

</body>

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