I have a single table that lists events. There are multiple dates that are the same. I want to show the date only once and then list the events appearing on each date.
I have tried the group by clause and the day only shows once, but I also only get the first event scheduled for that day.
The latest code I have tried is:
$result = mysql_query("SELECT DISTINCT racedate FROM tracevents");
$resultevt = mysql_query("SELECT racename, racedetails, email, web, location FROM tracevents");
// print races
echo "<table border=0 cellpadding=3 cellspacing=3>\n";
//print rows until you reach the end of the table
while ($date = mysql_fetch_row($result)) {
printf("<tr><td bgcolor=#990000><font face=arial, helvetica, sans-serif size=4 color=#FFFFFF><b>%s</b> </td></tr>\n", $date[0]);
while ($eventlist = mysql_fetch_row($resultevt)) {
printf("<tr><td bgcolor=#FFFFFF><font face=arial, helvetica, sans-serif size=2>%s <br>%s <br><a href=mailto:%s>Email Us</a> <br><a href=http://%s>Web Site</a> </tr>\n", $eventlist[0], $eventlist[1], $eventlist[2], $eventlist[3], $eventlist[4]);
}
}
echo "</table>\n";
echo "<p> </p>";
?>
With this I get the first date, then ALL the events on ALL dates, then the second date.
How can I change the code to get a date, all events for that date then the next date and all events for that date and so on.