Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mobile (3)
- Auburn (2)
- Array
- (
- [0] => Array
- (
- [0] => Array
- (
- [city] => Mobile
- [numLocations] => 3
- )
- [1] => Array
- (
- [city] => Auburn
- [numLocations] => 2
- )
- )
- )
- while($row = mysqli_fetch_assoc($result)){
- $state = $row['state'];
- $stateAbv = $row['stateAbv'];
- $city = $row['city'];
- $numSLocations = $values['cnt'];
- if (!isset($rows[$row['state']])){
- $rows[$row['state']] = array();
- }
- $rows[$row['state']][] = ['city' => $city, 'numLocations' => $numStores];
- }
- foreach($rows as $state => $cities){
- echo array_column($cities, 'numLocations'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement