Hi John,
I Maybe didn't make my example clear.
I used the "example vars" $dateToday and $dateThisRow to represent "Is this an event for today".
Looking at what you have posted, you are using $today and $begindate.
In my example, the logic works as follows:
If today is equal to the begin date of the event ($dateToday == $dateThisRow) then color this row Yellow.
If today and begin date DO NOT match, check to see which color (lightgrey or white) was used last
(not looking for yellow) and make this row the opposite.
$row_color = (date compare?equal today, make it yellow🙁row_color compare?it was white, make it lightgrey:it was NOT white, so make it white))
Do you see what this is doing?
There are two ternary statements. The first one: ($today == $beginDate?"Yellow":[second ternary statement])
gets it's "what to do if false" from the result of the second ternary statement.
The second ternary: ($row_color == "white"?"lightgrey:"white") gives the row color
(white if $row_color is not white, lightgrey if $row_color is white) back to the first ternary, thus if
the event is not today, you still get a row color.
One flaw is this: we don't check to see if the last row was yellow but since "yellow" is not "white",
you will always get a white row after a yellow row. There are ways to fix this as well, if it's a problem.
Save the value of $row_color to another var, say $lastRowColor ONLY if the current row
($row_color is white or lightgrey ie: != "yellow") and then use $lastRowColor to compare.
Also, my example was just that, an example for you to modify. Don't pate it right into your code and
expect to get the color results you are after as I don't know what actual <td bgcolor="#CACACA"></td>
tags you are using. So to demonstrate, I just used generic color names to serve as an example.
Another way (and there are still others...)
$row_color = "lightgrey"; //whatever color you wish to begin with
//do your sql stuff
while ($row = mysql_fetch_array($retid)) {
$begindate = $row("BEGIN_DATE");
$lastRowColor = ($row_color != "yellow"?$row_color:$lastRowColor); //save the last color used unless it was yellow, in whcih case $lastRowColor = $lastRowColor
If($today == $begindate) {
$row_color = "yellow";
}ElseIf($lastRowColor == "white") {
$row_color = "lightgrey";
}else{
$row_color == $lastRowColor;
}
//do display stuff here
} //end while()
Good luck!
Kevin