Hi,
I have a website which has a list of football fixtures - At the moment i pull them from a database and display them on the website as below
team a v team b 07/04/2010 15:00:00
team c v team d 07/04/2010 15:00:00
team e v team f 08/04/2010 17:15:00
As you can see they are ordered by date / time - What im trying to do though is display them as below:
07/04/2010
team a v team b 15:00:00
team c v team d 15:00:00
08/04/2010
team e v team f 17:15:00
Ive been racking my brains for a couple of days of the best way to do this - when i pull them from the database they are ordered but how do i put the header for each date. Ive thought of looping through the array and creating a new array for each day:
array( ‘07/04/2010’ => array of all matches
‘08/04/2010’ => those matches
but this seems long winded - ive thought using the group by in the mysql but then it occurred ill only get the same result. Ive thought of writing an sql query for each day and getting the results there but that seems to be a lot of processing.
Im not looking for the code to be written for me but just any explanation of how the top sports site do it - If anyone could help before i go bald id be grateful
Thanks