I want to populate an array with data from a database. I need it to have different labels from what is stated in database as headers.
This is how I need it to be formatted
[ { label: "Choice1", value: "value1" }, ... ]
I have used this but then I’m getting the wrong labels
$items = array();
while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) {
$items[] = $row_Recordset1;
}
eg.
[{"ID":"2","ARTIST":"!!!"},...]
I need it like this to use the jquery ui plugin for autocomplete
You need to return the data as a
JSONobject…Also you should look at using PDO instead of
MySQL_*functions as they are now deprecated.