I have code like this
$mene = date('Y-m-d h:i:s', strtotime('+1 days'));
$now = date('Y-m-d h:i:s');
$qnow = $this->db->query("SELECT pilihan,COUNT(pilihan) as total FROM votes WHERE date_create BETWEEN '$now' AND '$mene' GROUP BY pilihan");
$someArray = [];
foreach($qnow->result_array() as $row){
array_push($someArray, [
$row['pilihan'] => $row['total']
]);
}
$someJSON = json_encode($someArray);
echo $someJSON;
And this for result
[
{
"1": "213"
},
{
"2": "444"
}
]
How to make this result to single array, so result will be
[
{
"1": "213",
"2": "444"
}
]
Please help to resolve that, Thank you.