I am trying to echo inside Google charts but I am receiving this message Parse error: syntax error, unexpected '' . I tried to change all the possible combinations with quotes but still doesn't work. Can you please tell me where is the bug?
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Text', 'Number'],
<?php
while ($row = mysqli_fetch_array($data_query)) {
echo "['".$row['text']."', $row['number']. '"],'";
}
]);
var options = {
title: 'My Daily Activities'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
</head>