$sql = mysql_query(); $i = 0; while($f=mysql_fetch_array($sql)) { if($i % 2 == 0 ) {echo "color white"; } else { echo "color red"; } $i++; }