title: How to get php database values to javascript array
body: <p>Hi here i am using the jquery auto-complete plugin. i have some php retrieved database values i want to use those values in the autocomplete plugin. for that i want to get the php values to javascript array. how can i do this?</p>
  
  <pre><code>$(function() {
      var availableTags = [
        "ActionScript",
        "AppleScript",
        "Asp",
        "BASIC",
        "C",
        "C++",
        "Clojure",
        "COBOL",
        "ColdFusion",
        "Erlang",
        "Fortran",
      ];
      $( "#category" ).autocomplete({
        source: availableTags
      });
    });
  </code></pre>
  
  <p>Php:</p>
  
  <pre><code>&lt;?php
  require_once "config.php";
  $q = strtolower($_GET["q"]);
  if (!$q) return;
  $sql = "select distinct(category) from completer";
  $rsd = mysql_query($sql);
  while($rs = mysql_fetch_array($rsd)) {
      $fname = $rs['category'];
      echo "$fname"
  }
  ?&gt;
  </code></pre>