1

I want to retrieve data from the database and display it in a Graph/Chart on a webpage. In my database I have a table that contains 12 values showing the basic physical check-in details of a person. What I want is to display the results based on how many people checked in on a daily basis. The SQL would COUNT the amount of people checked in on a daily basis (MySQL), then display it on the chart page (php)

My question is how can I display this data for a Super user on a webpage? As the database is always being updated with new values each day, how would I go about creating a dynamic chart, graph or some other format that reads from the database and display the activity? Any code examples would be much appreciated. thank you.

BCL
  • 11
  • 3
  • 1
    How much have you done so far? Can you get the data out of the database? Do you know how to use the HTML Canvas element? – PeterMader May 31 '17 at 17:30
  • Yes but So far all I am able to do is display the values on a different Webpage in table format . This is my first attempt at using GoogleCharts. – BCL May 31 '17 at 17:33

1 Answers1

0

When you manage to retrieve your data from the database to your PHP - using PDO or mysqli. You can then just pass them into (output them) into the data array of the chart library you're using. Anytime the page gets refreshed PHP will get new data from the database thus it'll update the chart as well.

To create the chart I'd recommend using CharJS - it's simple and it comes with awesome documentation (lot's of examples).

If you need the data in real time (without the need to refresh the site), you'd have to use AJAX.

Here is a link to a question where they show you how to display data into a table. You just won't display a table but instead output the data into the chart data array (details in the chrt.js documentation).

Tony Vlcek
  • 446
  • 4
  • 18
  • I have no problem displaying all my data to a Table but still can not figure out how to display as a Chart. To be clear, I need to group the data by dates i.e. How many people checked in on a daily basis? – BCL Jun 03 '17 at 11:36