RE: Re: Table Output Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  Re: Table Output Question
Date: Mon, 14 Nov 2005 18:27:44 -0800

Bastien Koert <bastien_k@xxxxxxxxxxx> 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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux