I am using jquery autocomplete and trying to define the values for the auto complete options.
I am trying to create a javascript variable from a php array. So far i have:
<?php
$usernames = get_records_sql("SELECT firstname,lastname FROM {$CFG->prefix}user ORDER BY lastname DESC");
?>
<script language="javascript">
var names = ['<?php echo $usernames; ?>'];
</script>
I just need to convert the array to this format
var names= ["firstname lastname", "firstname lastname", "firstname lastname"];
Any help would be much appreciated.
<?php echo $usernames; ?>?