I'm constructing a very simple query, and want to display the results in a list, in date order, i.e.
2009-12-25
have lunch
drink beer
fall asleep
2009-12-26.
have breakfast
drink beer
have lunch
etc
My table is also very simple, 1 column for date and 1 column for event.
my query is
<?php
$query = "SELECT event_date, event_name FROM events WHERE event_date='$todaysdate'";
$result = mysql_query($query);
while($row = mysql_fetch_row($result))
{
$date = $row[0];
$event = $row[1];
echo "$date <br>" .
"$event <br>";
}
?>
As expected, the query returns the both the date and event in the list, i.e.
2009-12-25 have lunch
2009-12-25 drink beer
2009-12-25 fall asleep
2009-12-26 have breakfast
2009-12-25 drink beer
2009-12-25 have lunch
2009-12-25 etc
Is the anyway I can create a result where each data is not repeated unless it is unique?
I'm hoping the answer is so simple, that this is the reason I've not found anyone else reporting a similar frustration on the web!
Many thanks