Re: How to format every secound row in a database result
| From: | Martin dot C dot Austin at supervalu dot com | Date: | Wed, 30 Mar 2005 16:26:08 +0000 |
| Subject: | Re: How to format every secound row in a database result | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211893@lists.php.net to get a copy of this message | ||
Or you could simply test the $color variable to see its contents, and
change it if it's what you expected:
$color = "#FFFFFF";
if($color = "#FFFFFF") {
$color = "#000000";
//output
} else {
$color = "#FFFFFF";
}
There may be something inherently wrong in this approach, but it has
always worked for me. :o)
Martin Austin
Miles Thompson <miles@allnovascotia.com>
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 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 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
>not, and by that determent if the background color should be white or som
>ivory-like color to improve the readability in the result table...
>
>Hope to hear from anyone with experience in similar matters...
>
>TIA! Georg Herland, Norway
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php