Any you, please, could help me to fix this: I'm trying to connect a google timeline chart to my mysql database using PHP. I'm reading a loto on google but I realized I can't go further. Any one could give a hint on how this code below doesn't work? Any help will be appreciated. Also, I'm kind of basic in PHP.
Here is the code (not working) - also attached : <?php $con=mysql_connect("server","user","pass") or die("Failed to connect with database!!!!"); mysql_select_db("databasename", $con); // Later on I'll need to change the way to connect in a more secured way). $sth = mysql_query("SELECT * FROM google tablename"); $rows = array(); $flag = true; $table = array(); $table['cols'] = array( array('type' => 'string', 'label' => 'PersonName' ), array('type' => 'date', 'label' => 'start'), array('type' => 'date', 'label' => 'end')); //$rows = array(); while($r = mysql_fetch_assoc($sth)) { $temp = array(); $start = date("Y-m-d"); $end = date("Y-m-d"); $temp[] = array('v' => (string) $r['PersonName']); $temp[] = array('v' => (string) $r['start']); $temp[] = array('v' => (string) $r['end']); $rows[] = array('c' => $temp);} $table['rows'] = $rows; $jsonTable = json_encode($table); //echo $jsonTable; ?> <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["timeline"]}); google.setOnLoadCallback(drawChart); <!--Load the Ajax API--> function drawChart() { var container = document.getElementById('example3.1'); var chart = new google.visualization.Timeline(container); var dataTable = new google.visualization.DataTable(); var data = "" google.visualization.DataTable(<?php echo json_encode($table, JSON_NUMERIC_CHECK); ?>); var options = { title: 'Progress', is3D: true var options = { timeline: { colorByRowLabel: true } }; chart.draw(dataTable, options); } </script> </head> <body> <div id="timeline" style="height: 180px;"></div> </body> </html> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com. To post to this group, send email to google-visualization-api@googlegroups.com. Visit this group at http://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/b1ed15b7-df80-4503-8e91-1bf998f9a5dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
<<attachment: googletimeline.php>>