Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Mobile (3)
  2. Auburn (2)
  3.  
  4. Array
  5. (
  6. [0] => Array
  7. (
  8. [0] => Array
  9. (
  10. [city] => Mobile
  11. [numLocations] => 3
  12. )
  13.  
  14. [1] => Array
  15. (
  16. [city] => Auburn
  17. [numLocations] => 2
  18. )
  19.  
  20. )
  21.  
  22. )
  23.  
  24. while($row = mysqli_fetch_assoc($result)){
  25. $state = $row['state'];
  26. $stateAbv = $row['stateAbv'];
  27. $city = $row['city'];
  28. $numSLocations = $values['cnt'];
  29.  
  30. if (!isset($rows[$row['state']])){
  31. $rows[$row['state']] = array();
  32. }
  33.  
  34. $rows[$row['state']][] = ['city' => $city, 'numLocations' => $numStores];
  35. }
  36.  
  37. foreach($rows as $state => $cities){
  38. echo array_column($cities, 'numLocations'));
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement