<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<?php
$con = mysqli_connect('localhost', 'root', '', 'Materniteti');
$f = "select count(*) as f from neonatologji where gjinia=1";
$m = "select count(*) as m from neonatologji where gjinia=2";
$result=$con->query($f);
$row = $result->fetch_assoc();
$f = $row["f"];
$resultati=$con->query($m);
$row1 = $resultati->fetch_assoc();
$m = $row1["m"];
?>
<script type="text/javascript">
$(document).ready(function() {
// Build the chart
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Statistikat e gjinise se bebeve'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Vajza',
y: 22
}, {
name: 'Djem',
y: 6,
sliced: true,
selected: true
}]
}]
});
});
</script>
こんにちは! $ fがこのy:22の値instesdとy = 6の代わりに$ mを保存するという値が必要なので、javascriptをPHPに接続する方法はありますか?私はjsonでエンコードしようとしましたが、それは仕事をしなかったか、おそらく私はそれを間違って書いていましたが、間違いを犯すことはできません。誰かが助けてくれる?javascriptでphp変数を接続する
可能重複して値を取得することができます/ 23740548/how-to-pass-variables-and-data-from-php-to-javascript?rq = 1 –