joecooper Posted March 28, 2006 Share Posted March 28, 2006 I have a simple "while" loop that creates a table. but for appearance, i would like it to alternate in colours, as in 2 types of gray background or something. Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/ Share on other sites More sharing options...
Barand Posted March 28, 2006 Share Posted March 28, 2006 Check for odd/even row numbers[code]$count = 0;while (.....) { $bg = ($count++ % 2) ? '#EEEEEE' : '#CCCCCC'; echo "<TR style='background-color: $bg'>\n"; # cell data here echo "</TR>\n";}[/code] Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/#findComment-21528 Share on other sites More sharing options...
litebearer Posted March 28, 2006 Share Posted March 28, 2006 Might look here...[a href=\"http://www.phpfreaks.com/tutorials/5/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/5/0.php[/a]Lite..oops! too slow again. Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/#findComment-21529 Share on other sites More sharing options...
joecooper Posted March 28, 2006 Author Share Posted March 28, 2006 thanks! for the help, as im doing this whole project and have no time to test, i will let you know if it went well! thanks Link to comment https://forums.phpfreaks.com/topic/6000-alternating-table-colours/#findComment-21530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.