SHARE
TWEET

Untitled

a guest Jun 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top