an easy one, its long time i do not use mysql queries so maybe someone can help me out with this nooby question, i have a contacts table, id, name, and city.. i want to get all the contacts listed as follows.
city 1 -------- contact1 contact2 contact3 city 2 -------- contact4 contact7 contact10 city 3 -------- contact5 contact6 contact8
I do not want to use any additional php coding, just get the sql result like this
city 1
-> contact 1
-> contact 2
-> contact 3
city 2
-> contact 4
-> contact 7
-> contact 10
…
then fill the result in a php object and do like this:
foreach (cities as city)
{
// code here
}
Thanks in advance
Use GROUP_CONCAT