I am trying to group a list of event dates by their ending date. So if I have 15 events that end on the same date, I want all of those tr bgcolors to be red, then the next group, lets say 8 events all end on the same date, but different ending date than the first group, I want all those tr bgcolors to be black.
I want it to just keep alternating tr bgcolors (red, black, red, black)by blocks of ending dates. Please note that each block of ending dates has more than one event in it.
My current code, without the above piece in it:
$query = "select * from tbl_tourny WHERE archived != 'yes' ORDER BY sdate ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$id = $row['id'];
$name = $row['name'];
$games = $row['games'];
$location = $row['location'];
$state = $row['state'];
$cost = $row['cost'];
$sdate = $row['sdate'];
$timestamp = strtotime($sdate);
$newtime = date('m/d/Y' , $timestamp);
$edate = $row['edate'];
$timestamp3 = strtotime($edate);
$newtime3 = date('m/d/Y' , $timestamp3);
$age = $row['age'];
$age2 = $row['age2'];
$full = $row['full'];
$showsch = $row['showsch'];
echo "<tr><td><div align=center>$newtime</div></td><td><div align=center>$newtime3</div></td><td><div align=center>$location, $state</div></td><td><div align=center>$name</div></td><td><div align=center>$age</div></td><td><div align=center>$$cost</div></td><td><div align=center>$games</div></td></tr>";
}