php array in javascript variable for jquery autocomplete
<p>I am using jquery autocomplete and trying to define the values for the auto complete options.</p>

<p>I am trying to create a javascript variable from a php array.
So far i have:</p>

<pre><code>&lt;?php
$usernames = get_records_sql("SELECT firstname,lastname FROM {$CFG-&gt;prefix}user ORDER BY lastname DESC");    
?&gt;

&lt;script language="javascript"&gt;
var names = ['&lt;?php echo $usernames; ?&gt;'];
&lt;/script&gt;
</code></pre>

<p>I just need to convert the array to this format</p>

<pre><code>var names= ["firstname lastname", "firstname lastname", "firstname lastname"];
</code></pre>

<p>Any help would be much appreciated.</p>
