asmith Posted November 30, 2007 Share Posted November 30, 2007 i have some results from a table , i want to show them in html table tag . each row of mysql table goes to each row of html table tag. the question i've got is: what s the simplest way to switch the background colors of html table rows, you know for example odd rows goes white, even rows goes grey... Link to comment https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/ Share on other sites More sharing options...
revraz Posted November 30, 2007 Share Posted November 30, 2007 For me, using CSS. Link to comment https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/#findComment-402981 Share on other sites More sharing options...
asmith Posted November 30, 2007 Author Share Posted November 30, 2007 you define 2 classes for both rows, then apply CSS to them? Link to comment https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/#findComment-402983 Share on other sites More sharing options...
adam291086 Posted November 30, 2007 Share Posted November 30, 2007 this is how i did in using php for ($i = 0; $i < $_POST['num_images']; $i++){ // Determine alternate row colours if($i % 2 == 0){ $style = "bgcolor=\"#FFFFFF\""; $bottomstyle = "bgcolor=\"#FFFFFF\""; } else { $style = "bgcolor=\"#EFEFEF\""; $bottomstyle = "bgcolor=\"#EFEFEF\""; } Link to comment https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/#findComment-402984 Share on other sites More sharing options...
asmith Posted November 30, 2007 Author Share Posted November 30, 2007 gotcha ! thanks ! Link to comment https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/#findComment-402988 Share on other sites More sharing options...
roadshow Posted November 30, 2007 Share Posted November 30, 2007 if ($color == $color1){ $color = $color2; }ELSE{ $color = $color1; } Link to comment https://forums.phpfreaks.com/topic/79566-solved-switch-row-colors/#findComment-403012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.