I would like to print out candidate records in two colour where the bgcolour of a row changes when the ID of a candidate changes. The following is what I have written so far ...
PHP Code:$studPrevious = '';
$studCurrent = '';
//Display the results
while($row = mysql_fetch_array($filterQueryResult, MYSQL_ASSOC))
{
$studCurrent = $row['studentID'];
if($studCurrent == $studPrevious)
{
echo '<tr bgcolor="#CCCCCC" align="center" valign="middle">
<th scope="col">'.$row['studentID'].'</th>
<td>'.$row['firstName'].'</td>
<td>'.$row['secondName'].'</td>
<td>'.$row['examDate'].'</td>
<td>'.$row['moduleNumber'].'</td>
<td>Yes</td>
</tr>';
}
else
{
echo '<tr bgcolor="#FFCCCC" align="center" valign="middle">
<th scope="col">'.$row['studentID'].'</th>
<td>'.$row['firstName'].'</td>
<td>'.$row['secondName'].'</td>
<td>'.$row['examDate'].'</td>
<td>'.$row['moduleNumber'].'</td>
<td>Yes</td>
</tr>';
}
$studPrevious = $row['studentID'];
}//whie loop







Bookmarks