I can’t seem to get the result I need. Here is the array as it is provided by the sql query:
Array (
[0] => Array (
[id] => 7
[description] => Accepted )
[1] => Array (
[id] => 8
[description] => Declined )
[2] => Array (
[id] => 11
[description] => Deferred )
)
Here is the format for how I need to have it foreach of the objects listed above:
['7'][‘7’] = “Accepted”;
['7'][‘8’] = “Declined ”;
['7'][‘11’] = “Deferred”;
...where the first array[‘7’] is an added value and needed for each object.
Seems easy enough, but the foreach statements I created return an error “cannot use scalar value as an array”
$rows = /*Your Data above*/
$data = array('7'=>array());
foreach($rows as $row)
$data['7'][$row['id']] = $row['description'];
$jsonData = json_encode($data);
Might get 'er done