title: How to format a Mysql/php array for json?
body: <p>Asked this before, but I've narrowed down the issue to this bit of code. Here's my code, when I run it, it just says "null"..</p>
  
  <pre><code>$getmsg = "SELECT * FROM user WHERE account_id = $id";      
  $showmsg = @mysqli_query ($dbc, $getmsg);
          while ($row = mysqli_fetch_array($showmsg, MYSQLI_ASSOC)) {
  
  $arrResults = array($row['user_username']);
  
  
  } // END WHILE
  
  
  // Print them out, one per line
  echo json_encode($arrResults);
  </code></pre>