title: mysql table to json
body: <p>I am planning to use jQuery UI Autosuggest for a search form. So I need a json output which can be used by jQuery UI Auto suggest.</p>
  
  <p>Here's the database <img src="https://i.stack.imgur.com/9KvQw.png" alt="alt text"> </p>
  
  <p>Table name recent_tags</p>
  
  <p>I have tried this</p>
  
  <p>First connect to db</p>
  
  <pre><code>$do = mysql_query("SELECT * FROM recent_tags where query like '%" . $_GET['query'] . "%'"); 
  
  while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
      $row_array['query'] = $row['query'];
      array_push($return_arr,$row_array);
  }
  
  echo json_encode($return_arr);
  </code></pre>
  
  <p>but It's not working..</p>
  
  <p>Please guide me..</p>
  
  <p>EDIT :</p>
  
  <p>getting error</p>
  
  <blockquote>
    <p>Warning: array_push() [function.array-push]: First argument should be an array in /pathto/my/file.php</p>
  </blockquote>
  
  <p>Thanks</p>