RE: [PHP-DB] Table Output Question
| From: | Bastien Koert | Date: | Tue, 15 Nov 2005 01:15:44 +0000 |
| Subject: | RE: [PHP-DB] Table Output Question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40660@lists.php.net to get a copy of this message | ||
<?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
From: Jeff Grossman <jeff@stikman.com> To: php-db@lists.php.net Subject: [PHP-DB] Table Output Question Date: Mon, 14 Nov 2005 15:37:36 -0800 I have a table, where each line is the output of a query from a MySQL database. I do not use borders, so the page is a little difficult to read sometimes. Is it possible, or how do I, alternate the background color of each row when I output it? My code is like this: while (query) { <TR> <TD></TD> </TR> } I am not sure how to output two rows in the same while loop. Thanks for any help you can offer me. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php