I'm having a total brain fart and can not seem to get the right logic for

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.

The one constant is that if ($row->show_title) is true the table row will
have a background color then I need to make the rows after that alternate
until if ($row->show_title) is true again.

Roughly I have the whole thing laid out like this right now:

echo "<table BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"2\">\n";
while($row = mysql_fetch_object($result)) {
    if($row->show_company && $row->show_title && $row->show_month) {
                display month;
    } else if ($row->show_title) {
                display title;
                display first row with background color;
    } else {
                display rows with no background color; //right here needs to alternate
<tr> background color
echo "</table>";

I think I've been looking at his too long and I just have jello brain right
now but I just can't seem to straighten this out in my head...

Thanks for the help...


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

Reply via email to