Jump to content

PHP "Grouping"


ckpicker

Recommended Posts

I've got a MySQL table called Locations with the following structure: ID, Region, State, Retailer.

 

Given a region (Ie: Midwest) I would like to output my results by state by looping through my result set. Ex:

 

Arkansas:

  Retailer 1

  Retailer 2

  Retailer 3

 

California:

  Retailer 1

  Retailer 2

 

etc...

 

Any ideas?

 

Link to comment
https://forums.phpfreaks.com/topic/154789-php-grouping/
Share on other sites

Not sure why this was moved to the MySQL forum.  I'm looking for a way to loop through the result set in PHP...

 

Cause that's how you would extract it from your database, using GROUP BY.

 

But I still want the invidual records to display.  Won't a 'group by' query consolidate all the rows down to one?

Link to comment
https://forums.phpfreaks.com/topic/154789-php-grouping/#findComment-814007
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.