I've executed a query that returns results such as:
state city
ID A
ID B
CO C
MS D
MS E
MS F
I'd like to process the results by state. So for instance if I had an array of just the first state:
state city
ID A
ID B
Then I could iterate through this array and process appropriately. I'd then want the next state array: [state]=> CO, [city] =-> C, and so on.
What I'm struggling with is how to return more than one record from a result set at a time, specifically to group them by state. I know I can use $row = mysql_fetch_array($result) to give me one row. But is there an easy way to return a subset of my result array as another smaller array based on the value of a variable such as state?
All suggestions are appreciated.