$col = "white"; while($a1 = mysql_fetch_array($r1)) { if($col == "white") { $col = "dddddd"; } else { $col = "white"; } echo "<tr bgcolor=$col>"; echo "<td><a href=\"#\">Teste</a>"; echo "</td><td align=center>Teste</td></tr>"; }