how to connect to my database php with google chart… database name=person_detail, table=gender, type=(1)girl , (2)boy, data (2,5)… not working and donknow why
<?php $dbhandle = new mysqli('localhost','root','','person_detail'); echo $dbhandle->connect_error; $query = "SELECT * FROM gender"; $res = $dbhandle->query($query); ?> google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() {
var data = google.visualization.arrayToDataTable([
['girl', 'boy'],
<?php
while($row=$res->fetch_assoc())
{
echo “[’”.$row[‘sum(girl)’]."’,".$row[‘sum(boy)’]."],";
}
?>
]);
var options = {
title: 'Gender Statistic',
is3D:true,
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>