php mysql question?

jmad

New Member
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

Super Moderator
Staff member
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.
 

Imagn

New Member
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
 
Top