i have an result from mysql query and i can able fetch data and push to normal array format and also encoded as json and my output looks like
here is my php code
$query1 = mysql_query($myquery1);
if ( ! $query1 ) {
echo mysql_error();
die;
}
$data1 = array();
for ($x = 0; $x < mysql_num_rows($query1); $x++) {
$data1[] = mysql_fetch_assoc($query1);
}
echo json_encode( $data1);
Where myquery1 has the result from mysql select statement
My json result is
[{"Date":"2017-12-01","users":"5","d0":"5","d1":"0","d2":"0","d3":"0","d4":"0"},
{"Date":"2017-12-02","users":"0","d0":"0","d1":"0","d2":"0","d3":"0","d4":"0"},
{"Date":"2017-12-03","users":"0","d0":"0","d1":"0","d2":"0","d3":"0","d4":"0"},
{"Date":"2017-12-04","users":"1","d0":"1","d1":"0","d2":"0","d3":"0","d4":"0"},
{"Date":"2017-12-05","users":"1","d0":"1","d1":"0","d2":"0","d3":"0","d4":"0"},
{"Date":"2017-12-06","users":"1","d0":"1","d1":"0","d2":"0","d3":"0","d4":"0"}]
My expected result has to like this , how can i achieve this
[{"Date":"2017-12-01","users":"5","d0":"5","d1":"0","d2":"0","d3":"0","d4":"0"},
{"Date":"2017-12-02","users":"0","d0":"0","d1":"0","d2":"0","d3":"0"},
{"Date":"2017-12-03","users":"0","d0":"0","d1":"0","d2":"0"},
{"Date":"2017-12-04","users":"1","d0":"1","d1":"0"},
{"Date":"2017-12-05","users":"1","d0":"1"},
{"Date":"2017-12-06","users":"1"}]
I am a beginner in php, please do help with this