View Full Version : php mysql question?
i am trying display all contents of a table my question is how do i make the records have alternating backround colors? i know it can be done jus trying to figure it out. thanx. also i was wondering in php can u have a if statment in a while statement?
jake madison
zkiller
03-19-2007, 10:12 PM
instead of just including one row in your loop, include two setting different colors for each. i don't know php, so i don't know the exact code, but the concept is the same as with other languages.
not sure how to do that. but i am tryin. any input on the "if" in a "while" statement?
Imagn
09-12-2007, 07:14 AM
Add this line at the start of your loop:
$class = "altRow";
<-- START LOOP -->
if ($class == "altRow") {
$class = "altRow2";
} else {
$class = "altRow";
}
<-- END LOOP -->
Obviously add the style call ('altRow' or 'altRow2') to either your row or cell
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.