Re: [PHP] How to format every secound row in a database result

2005-03-30 Thread tg-php
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

Re: [PHP] How to format every secound row in a database result

2005-03-30 Thread Leif Gregory
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

Re: [PHP] How to format every secound row in a database result

2005-03-30 Thread Martin . C . Austin
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

Re: [PHP] How to format every secound row in a database result

2005-03-30 Thread Miles Thompson
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

Re: [PHP] How to format every secound row in a database result

2005-03-30 Thread Jochem Maas
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