Chartjs-How to update a chart taking by querying a database?

0👍

Answering my own question as I found a solution to it lately.

There was a minor error in the while loop, being referred below

while($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
    extract($row);
    $json_inDate = $inDate;
    $json_occurrence = (int)$occurrence;
}

The values from database being read should be stored into $json_inDate[] and $json_occurrence[] and NOT $json_inDate and $json_occurrence. Very minor error done in the thick of time. The code works perfectly fine with these amendments.

Regards and thanks.

Leave a comment