RE: [PHP-DB] Re: Table Output Question

From: Date: Tue, 15 Nov 2005 04:47:18 +0000
Subject: RE: [PHP-DB] Re: Table Output Question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-40668@lists.php.net to get a copy of this message
Simply put, you create a couple of css classes that make the row look the way you want and then while ($rows = mysql_fetch_array($result)) { $color = ($counter % 2 ==0) ? "rowclass1" : "rowclass2" ; echo "<tr class='$color'><td>..."; } Its essentially the same thing, just neater and lets you concentrate on the code for the table without the worry about the way the row looks Bastien
From: Jeff Grossman <jeff@stikman.com> To: php-db@lists.php.net Subject: [PHP-DB] Re: Table Output Question Date: Mon, 14 Nov 2005 18:27:44 -0800 Bastien Koert <bastien_k@hotmail.com> wrote: <?php $row1 = "FFFFFF"; $row2 = "AAAAAA"; $counter = 0; while ($rows = mysql_fetch_array($result)) { $color = ($counter % 2 ==0) ? $row1 : $row2 ; echo "<tr style='backgroundcolor:$color'><td>..."; } bastien ps: a class css definition would be better here Thanks for the help. After reading a couple of the responses, I couldn't believe that I did not think of this. I don't know a lot about CSS yet (just purchased a book). But, could you share with me about the ps line? Thanks again for you help. Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#40668) next »