Hi
I am trying to connect the google timeline chart to mysql, but I managed to get the connection working but I am not sure how to echo the data from my table. Could you please help me out here? Thanks
so I want to display the goals currently in the goal table I need the goalName, starts, finish and progress. Here is the code:
<?php
session_start();
$con=mysqli_connect("localhost","root","","") or die("Error " . mysqli_error($connection));
if (!$con) {
die('Could not connect: ' . mysql_error());
}
$query = "SELECT goalName, progress, starts, finish FROM goal";
$result = mysqli_query($con,$query) or die(mysqli_error());
list($row) = mysqli_fetch_array($result);
?>
<html>
<head>
'version':'1','packages':['timeline']}]}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var container = document.getElementById('example3.1');
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'goalName' });
dataTable.addColumn({ type: 'date', id: 'starts' });
dataTable.addColumn({ type: 'date', id: 'finish' });
dataTable.addRows([
])
var data = google.visualization.arrayToDataTable([
['goalName', 'starts', 'finish','progress'<?php echo $row; ?>]
]);
var options = {
title: 'Progress',
is3D: true
};
chart.draw(datatable);
}
</script>