So,

I'm just beginning to learn PHP and know how to do a simple foreach loop to echo out data from a MySQL query set array. Nothing weird there, but I have no idea on how to do it a bit more advanced

My MySQL set contains data from three tables: Name, city and date. It's sorted with ORDER BY date, city.

What I would like to output is different "blocks" of data depending on the city and the date. Let's say we have the following data:

Mark, Chicago, 2012-11-25
John, New York, 2012-11-25
Jane, New York, 2012-11-25
Lisa, Dallas, 2012-11-26
Jenny, Miami, 2012-11-26
Nina, Miami, 2012-11-27

What I would like the result to look like when the loop is done is something like this:

2012-11-25

Chicago


Mark

New York

John
Jane

2012-11-26

Dallas


Lisa

Miami

Jenny

2012-11-27

Miami


Nina

_______

If anyone can point me in the right direction here or maybe just give me a link to something similar, it would be great. But don't just tell me exactly what to do, then I won't learn anything. :)