Generate array in PHP for JavaScript function
<pre><code>&lt;script&gt;

$(function() {

    var availableTags = [

        "ActionScript",

        "AppleScript",

        "Asp",

        "BASIC",

        "C",

        "C++",

        "Clojure",

        "COBOL",

        "ColdFusion",

        "Erlang",

        "Fortran",

        "Groovy"
    ];

    $( "#fname" ).autocomplete({

        source: availableTags

    });

});
</code></pre>

<p></p>

<p>The above function helps me to achieve auto complete using static values, what I want is to get these values from the database. I wrote a php function that connect to the db but I am not sure how to pass the return value of that function to the javascript page below is snippet of that.</p>

<pre><code>function getAllDrugs(){
$med = "";
$select = mysql_query("SELECT dname FROM phar_store_config where quantity &gt; 1");

while($row =  mysql_fetch_array($select)){

$med = $med.$row['dname'];

}
return $med;
}
</code></pre>

<p>Now i want the return value of the above php function to be passed to my js function.</p>

<p>Any help will be appreciated.</p>
