I've used the mod (%) function to do this, which also gives you the flexibility
of defining how many lines to alternate the colors or do whatever you need to
do every "X" lines.
Another method (and forgive me if this was mentioned, I didn't see it yet) is
to use a bitwise NOT to flip-flop a val
Hello Georg,
Wednesday, March 30, 2005, 8:05:30 AM, you wrote:
G> I wish to format the output of a database select. The result is
G> presented in a table, in which i'd like to present everey secound
G> row with a different background color. My idea was to test if the
G> remaining number of rows wh
ly wrong in this approach, but it has
always worked for me. :o)
Martin Austin
Miles Thompson <[EMAIL PROTECTED]>
03/30/2005 10:18 AM
To: php-general@lists.php.net
cc:
Subject: Re: [PHP] How to format every secound row in a
database result
Maintain
Maintain a counter as you display the returned results.
Mod the counter by 2 (rowcounter % 2), set colour according to presence /
absence of a remainder.
Miles
At 11:05 AM 3/30/2005, Georg wrote:
Hi!
I wish to format the output of a database select.
The result is presented in a table, in which i'd
Georg wrote:
Hi!
I wish to format the output of a database select.
The result is presented in a table, in which i'd like to present everey
secound row with a different background color.
My idea was to test if the remaining number of rows where a prime number or
modulo 2 is the current row 'num
5 matches
Mail list logo