After executing a fetch query I get a result array:
[row_choice] => Array
(
[0] => Array
(
[id] => 277410
[text_value] =
You should create a new array variable as below.
$recArr = array();
while ($records = mysqli_fetch_array($query)) {
$recArr[$records['id']] = $records;
}
var_dump($recArr);
Good luck.
It isn't possible directly from the SQL query: but you can retrieve all your data, then re-map the array
Using PHP 5.5's array_column() you can do something like:
$myarray['row_choice'] = array_combine(
array_column($myarray['row_choice'], 'id'),
$myarray['row_choice']
);
else for earlier versions of PHP, use array_map() instead
$myarray['row_choice'] = array_combine(
array_map(
function($value) {
return $value['id'];
},
$myarray['row_choice']
),
$myarray['row_choice']
);