Let multiple highcharts charts appear automatically from mysql data
- by martini1993
I have the following problem. I want to make multiple Highcharts webcharts appear automatically based on the data from the database. Let's say we have the following database:
___________________________________________________________________
| | | | | | |
| Year | Month | ID | Name User | Wins | Losses |
|_______|___________|______|_______________|____________|__________|
| 2013 1 21 Tony Stark 3 12 |
| 2013 1 52 Bruce Wayne 5 4 |
| 2013 1 76 Clark Kent 9 5 |
|__________________________________________________________________|
(This database is an example, there are a lot more rows in the real database.)
And i have the following query:
SELECT
a.year AS year1,
a.month AS month1,
a.id AS id,
a.name AS nameuser,
a.wins AS wins,
a.losses AS losses
FROM Sales a
WHERE
a.month = 1 AND
a.year = YEAR(NOW())
With this, it is very easy to hardcode a chart with Highcharts. But what I want is that there has to be a webchart per user. So instead of a single webchart with all the users in it, I want multiple charts next to each other based on the data from the database.
So instead of this:
http://jsfiddle.net/CWSb6/
I want this (But then next to each other):
http://jsfiddle.net/DReMD/
It has to be generated automatically with php and mysql. So if there is a new user starting this month, and the new user is saved in the database, the page automatically displays the new user with the related web chart.
I find this very hard to accomplish and I need some help to get to the right direction for the solution.
Many thanks in advance!
(Sorry for my bad english.)