Home forums Using CanvasJS How can I use PHP MySQL Dynamic data Reply To: How can I use PHP MySQL Dynamic data



Hi Sunil,

First of all thank you so much and best wishes for your efforts and creating such a beautiful chart utility.
I am new to php however I managed to use your peice of code above to create charts from mysql. But I have a specific requirement of showing chart from mysql and also data used in that chart in a a HTML table. I got success to create chart using above code however struggling in the second part.

I am using 3 file, Main.php, data.php and create_chart.js. In data.php code for pulling mysql data n encoding it to json is used. Then I have used te json data in JS file to create chart. In my main php file I am calling my JS file to render chart. Below the chart I want to show the HTML table. So i am trying to call data.php file using “include (‘data.php’)”. But when I do so, due to << echo json_encode … >> line the array is also displaying on the page which I don’t want. I also don’t want to run same SQL query 2 times to get the chart and data.

Please help me on this. That will be great help.