title: PHP mysqli_fetch_assoc stored into an array
body: <p>I am having troubles pulling a row from sql query and storing it into an array. Here is my code. </p>
  
  <pre><code>$sql = "SELECT water, importdate
          FROM customer_table
          WHERE customer_number = '" . $custNum . "';";
          $result_of_login_check = $this-&gt;db_connection-&gt;query($sql);
          echo $sql . "&lt;br&gt;";
          $result = mysqli_query($this-&gt;db_connection,$sql);
  
          // set array
          $array = array();
  
          // look through query
          while($row = mysqli_fetch_assoc($result)){
  
          // add each row returned into an array
          $array[] = $row;
          }
          print_r($array);
  </code></pre>
  
  <p>This is what the output looks like when I print the array, </p>
  
  <pre><code>Array ( 
      [0] =&gt; Array ( 
          [water] =&gt; 23 
          [importdate] =&gt; 2014-03-29 
      ) 
      [1] =&gt; Array ( 
          [water] =&gt; 33 
          [importdate] =&gt; 2015-02-22 ) 
      )
  </code></pre>
  
  <p>While it is storing, I am stuck at trying to figure out how to copy each row into the array so it looks like this, </p>
  
  <pre><code>Array ( 
      [water] =&gt; 23 
      [importdate] =&gt; 2014-03-29
  ) 
  Array ( 
      [water] =&gt; 33 
      [importdate] =&gt; 2015-02-22
  )
  </code></pre>
  
  <p>Which is each row stored in $row.</p>
  
  <p>What I am going for is that I need to pull a list of bill amount and dates from the same customer from my database and then display each month by date. Showing the current months bill.</p>
  
  <p>Thanks for your help!</p>