Hello I am trying to create a chart based on clicks information.
How to do so ?
// print jumlah klik dalam graphic
$result = mysql_query("SELECT COUNT(idads) AS countidads FROM adsmgt") or die(mysql_error());
$resultday = mysql_query("SELECT COUNT(idads) AS countidadsday FROM adsmgt GROUP BY date") or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "Number of ad clicks: ".$row['countidads'];
}
$result2 = mysql_query("SELECT waktu, date, time FROM adsmgt") or die(mysql_error());
echo "<br>";
echo "<br>"."Tanggal"."   "."       Waktu"."       Jumlah clicks per hari";
while($row2 = mysql_fetch_array($result2))
{
echo "<br>".$row2['date']."   ".$row2['time']."   ".$row['countidadsday'];
}
while($rowday= mysql_fetch_array($resultday))
{
echo $rowday['countidadsday'];
}
//php_info();
// Graph - http://www.ebrueggeman.com/phpgraphlib/examples
?>
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['date', 'Number of clicks per hari'],
['18', 10, ],
['19', 11, ],
['20', 8, ],
['21', 5, ]
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Date', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
This is what I have so far. Just one problem - I am using Google Chart. The information is not updated since I have to enter it manually to the graph and is not automatic. I would like it to be automatics based on the ads click. Is that posible?