RE: [PHP] Brain Fart- table formatting help
| From: | Brian V Bonini | Date: | Mon, 29 Jul 2002 14:26:44 +0000 |
| Subject: | RE: [PHP] Brain Fart- table formatting help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110173@lists.php.net to get a copy of this message | ||
Isn't that the same thing essentially? See, from the time ($row->show_title)
is true until it is true again is not a fixed number so the only constant is
that if ($row->show_title) is true then the <tr> background color will be
on. Then I need to alternate the background color between on and off until
($row->show_title) is true again. Then start the process over. So I'm sure
my ignorance has prevented me from fully understanding what you tried to
show me below but isn't that the same as saying:
if ($i&1) {
do this;
} else {
do this;
}
which is the same as if ($i%2) { etc..... }
???
-B
> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
> Sent: Monday, July 29, 2002 9:19 AM
> To: 'Brian V Bonini'; php-general@lists.php.net
> Subject: RE: [PHP] Brain Fart- table formatting help
>
>
> [snip]
> I'm trying to format the output of a db query with alternating row colors,
> the thing is the usual
> if ($i%2) {} will not work here because the alternating colors do not
> necessarily fall on odd or even rows.
> [/snip]
>
> <?php
> $i = 0;
> while($exrows = mysql_fetch_object($dbcdrex)){
> $bgcolor = ($i++ & 1) ? '#FFFFFF' : '#CCCCCC';
> //other table stuff
> ?>
>
> HTH!
>
> Jay
>
> Minds are like parachutes
they only function when OPEN
>
> *************************************
> * Want to meet other PHP developers *
> * in your area? Check out: *
> * http://php.meetup.com/ *
> * No developer is an island ... *
> *************************************
>
> ***************************************
> * *
> * Texas PHP Developers Meeting *
> * Spring 2003 *
> * T Bar M Resort & Conference Center *
> * New Braunfels, Texas *
> * Interested? Contact; *
> * jay.blanchard@niicommunications.com *
> * *
> ***************************************
>
>