Re: Alternate row color

From: Date: Wed, 09 Aug 2000 04:32:45 +0000
Subject: Re: Alternate row color
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10841@lists.php.net to get a copy of this message
Tyler, Try the following code. It should alternate between white and gray background colors. if ($rownum%2) $color = "#ffffff"; else $color = "#777777"; print("<TD BGCOLOR=$color>"); I hope that this helps. Thanks. Peter > Hello, > > How could I alternate table row colors by using a for or while loop? It > can't be that hard. I just can't grasp it. I will be gettting the rows > out of a MySQL db, and I want to alternate the colors on a page. Any > examples? > > Regards, > -- > Tyler Longren > [Web Development] > Premier Visual Services > http://www.pvs2000.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#10841) next »