$array_numbers = [
['number' => 1000, 'percent' => 13, 'id' => 6768, 'term' => 12],
['number' => 1500, 'percent' => 13, 'id' => 6769, 'term' => 24],
['number' => 2500, 'percent' => 16, 'id' => 6770, 'term' => 8],
['number' => 500, 'percent' => 15, 'id' => 6771, 'term' => 2],
['number' => 500, 'percent' => 15, 'id' => 6772, 'term' => 4], ];
I want to create array like this but, values should be select from the mysql table.
‘number’ is by column name ‘1500’ , ‘2500’ is the value.
How can i do ?
my query is
$exe_id = 1;
$query=$db->prepare("SELECT * FROM number_list ORDER BY list_id DESC");
$query->execute();
while ($execute=$query->fetch(PDO::FETCH_ASSOC)){ $exe_id++;
$arr_numbers[$execute['number']]=$execute['percent'];
}
with this code, i can create array includes only number and percent. I want ‘id’ and ‘term’ too.
Thanks.