here's one way, set a variable and switch it on and off

$tr_properties = 'style="background-color: grey;"';
while(  $ect =  etc   ) {
         print "<tr $tr_properties>";
        $tr_properties = false;
     } else {
         print "<tr>";
        $tr_properties = 'style="background-color: grey;"';

you sould refine the code and simplify it but that is basic principle.


Christopher J. Crane wrote:
> 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...

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to