The following code can make a table with colored using two colors alternatively:
$num = mysql_num_rows($qPhysician);
$i=0;
echo "<table>"
while($i < $num)
{
if ($i % 2 == 0){
echo "<tr class='style1'>";
}
else{
echo "<tr class='style2'>";
}
echo "<td>" . mysql_result($qPhysician,$i,"lastName") . "</td>";
echo "<td>" . mysql_result($qPhysician,$i,"firstName") . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
Suppose I have multiple colors. red, green, yellow, blue etc. Is there any way to make a table colored using these colors alternatively? How will I do that?