รายละเอียดของการตอบ ::
<?php
$serverName = "MKNB03\SQLEXPRESS"; //serverName\instanceName
$connectionInfo = array( "Database"=>"dbtest", "UID"=>"sa", "PWD"=>"sa123456");
$con = sqlsrv_connect( $serverName, $connectionInfo);
?>
<html>
<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([
['Id', 'sv'],
<?php
$query = "SELECT * FROM [dbo.TankTable] WHERE tankname ='Water Rinse 4'";
// $rs = sqlsrv_fetch_array( $con, $query);
$stmt = sqlsrv_query( $conn, $sql , $params, $options );
foreach($stmt as $stmt_c){
echo "['".$stmt_c['Id']."',".$stmt_c['sv']."],";
}
?>
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
รบกวนดูให้หน่อยครับว่าผิดตรงไหน ผมลองแล้วไม่ขึ้นกราฟ