title: Google charts from MySQL
body: <p>I have tried for several hours to get MySQL data in a Google charts but I can't wrap my head around how to make a working page from the examples I've come across on the internet.</p>
  <p>To start fresh I took a example from Google charts and manually filled it with data. This gives me the graph I want to have.
  the Google charts graph is generated by a simple HTML PAGE (JUST THE VARIABLE PART:</p>
  <pre><code>....
        function drawChart() {
          var data = google.visualization.arrayToDataTable([
            ['date',          'Baxico'    ,   'Degriek'   ,    'Foldman'  ,   'Madmeijs'  ,   'Marcello'  ,   'Meijster'  ,   'Pokermom'],
            ['110415180035',  38,             1,              16,             10,             6,              4,              25        ],
            ['110415190222',  38,             16,             6,              4,              1,              25,             10        ],
            ['110415200747',   6,             38,             25,             10,             1,              16,             4         ],
            ['110415211933',  10,             38,             6,              25,             4,              16,             1         ],
            ['110415222033',  16,             1,              10,             6,              38,             25,             4         ],
            ['110415232833',  38,             4,              1,              25,             10,             6,              16        ]
          ]);
  
          
  </code></pre>
  <p>I made the same data output in MySQL:</p>
  <pre><code>select tournamentid
  ,(select points  from pokermax_scores as t2 where playerid = 'Baxico' and t1.tournamentid = t2.tournamentid) as Baxico
  ,(select points  from pokermax_scores as t2 where playerid = 'Degriek' and t1.tournamentid = t2.tournamentid) as Degriek
  ,(select points  from pokermax_scores as t2 where playerid = 'Foldman' and t1.tournamentid = t2.tournamentid) as Foldman
  ,(select points  from pokermax_scores as t2 where playerid = 'Madmeijs' and t1.tournamentid = t2.tournamentid) as Madmeijs
  ,(select points  from pokermax_scores as t2 where playerid = 'Marcello' and t1.tournamentid = t2.tournamentid) as Marcello
  ,(select points  from pokermax_scores as t2 where playerid = 'Meijster' and t1.tournamentid = t2.tournamentid) as Meijster
  ,(select points  from pokermax_scores as t2 where playerid = 'Pokermom' and t1.tournamentid = t2.tournamentid) as Pokermom
  from pokermax_scores as t1
  group by tournamentid
  </code></pre>
  <p>which results in same data:
  <a href="http://i60.tinypic.com/6nqp76.png" rel="nofollow noreferrer">http://i60.tinypic.com/6nqp76.png</a></p>
  <p>But I can't get the data loaded as shown in this example:
  <a href="http://datamakessense.com/google-charts-api-from-your-sql-database-to-a-live-chart-with-no-coding-skills/" rel="nofollow noreferrer">http://datamakessense.com/google-charts-api-from-your-sql-database-to-a-live-chart-with-no-coding-skills/</a></p>
  <p>I can make the database connection, and paste in the SQL, but I'm unclear how to set the script so it takes the data from the SQL.</p>