That is not grouping, that's just printing the month in front of the data.
When you do a query and use "ORDER BY date_field"
you already get the records in the right order.
What you have to do in PHP is:
- Do the query
- start a loop that will print all the months you want to print.
- - print the first date
- - check if there are more records in the resultset
- - - if yes, check if the record should be printed for this month
- - - - if yes, print it and move to the next record from the resultset
- - - - if no, move to the next month
- - - if no, move to the next month
- end loop