> How do you alternate colors of the rows in a table inside a > while statement > when dealing with the output of data from a DB. I am sure > it's something > simple but I keep getting into some really long math thing...
For two alternating colours I normally do something like this: $use_col = "#00FF00"; While (some = condition) { echo "using $use_col"; if ($use_col == "#00FF00") { $use_col = "#0000FF"; } else { $use_col = "#00FF00"; } } Basically, set a colour to use, then in your while loop you see if it is one of the colour, if it is change it to the other. If it isn't the colour you tested for then it's already the other colour so change it back. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php