$col = "white"; while($a1 = mysql_fetch_array($r1)) { if($col == "white") { $col = "dddddd"; } else { $col = "white"; } echo ""; echo "Teste"; echo "Teste"; }