title: Getting also column names
body: <p>I'm retrieving some data from a database and convert it into JSON:</p>
  
  <pre><code>if ($result = $link-&gt;query($query)) {
      while($row=mysqli_fetch_row($result)){
          $json['results'][]=$row;
      }
  }
  echo json_encode($json);
  </code></pre>
  
  <p>This is the result:</p>
  
  <pre><code>{"results":
   [["1","0","123","456",null],
   ["2","0","567","978",null]]
  }
  </code></pre>
  
  <p>But I also need the column names.</p>
  
  <p>When I change it to <code>mysqli_fetch_assoc</code>, I get the following response in my console:</p>
  
  <pre><code>{"readyState":4,"responseText":"","status":200,"statusText":"OK"}
  </code></pre>