There is a code that works fine. But when I set the priority WHERE pollid = 3; Chart is not displayed. Please help me correct the error, or find a method for how to display data for a chart with a specific cell value pollid.
<?php header('Content-Type: text/html; charset=utf-8'); ?> <?php $connect = mysqli_connect("localhost", "root", "", "mysitekatya"); $query = "SELECT choice, count(*) as number FROM choices GROUP BY choice "; $result = mysqli_query($connect, $query); ?> <!DOCTYPE html> <html> <head> <title>MyGr1</title> <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([ ['choice', 'Number'], <?php while($row = mysqli_fetch_array($result)) { echo "['".$row["choice"]."', ".$row["number"]."],"; } ?> ]); var options = { title: 'Вот', //is3D:true, pieHole: 0.4 }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script> </head> <body> <br /><br /> <div style="width:900px;"> <h3 align="center">Стоит ли заниматься йогой при беременности?</h3> <br /> <div id="piechart" style="width: 900px; height: 500px;"></div> </div> </body> </html>