php - Load Json Data into an AmChart


I beginner to Amchart and am test load data in Amchart using php this is my format json


and this is my code

var data1 = <?php
$data = array();
$arr = array();
$query = "SELECT * FROM shell_table_graph";
$db = mysql_query($query);
while($rows = mysql_fetch_assoc($db)) {
     $data[] = ['column' => $rows['column'], 'formula' => $rows['calculation']];
foreach($data as $rowss) {
    $formula = $rowss['formula']; 
    $query = "SELECT Date, SUM(".$formula.") AS Formula FROM eod_split_interval WHERE Date BETWEEN '2018-01-01' AND '2018-01-05' GROUP BY Date";
    $db = mysql_query($query);
    while($r = mysql_fetch_assoc($db)) {
         $arr[] = ['date' => $r['Date'], $rowss['column'] => $r['Formula']];
        $code = json_encode($arr);

echo $code;

People are also looking for solutions to the problem: mysql - XML Output in PHP (UTF-8)


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.