Hi there
Let's say I've pulled out a multiple records from a mysql database using php: i have selected name and city from a table for several people.
Now I would like to print just thos people from cityA in one div, those from cityB in another and so on.
The newbie in me wants to create seperate queries for each city:
"SELECT name, city FROM table WHERE city = 'Sydney'" etc
But I'm assuming it is more efficient to do one query:
"SELECT name, city FROM table";
and then divide the results into seperate arrays for each city and work with them.
Am I on the right track?
If I have retrieved an associative array from the database using mysql_fetch_assoc, how can I then loop through this and create an array fr each city?
Once I have an array for each city, waht is the best way to loop though that to echo out the elements?
bongoman