| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/kpiit/ |
Upload File : |
<?php
//ตั้งค่าการเชื่อมต่อฐานข้อมูล
$database_host = 'localhost';
$database_username = 'root';
$database_password = '017621997';
$database_name = 'mit';
$mysqli = new mysqli($database_host, $database_username, $database_password, $database_name);
//กำหนด charset ให้เป็น utf8 เพื่อรองรับภาษาไทย
$mysqli->set_charset("utf8");
//กรณีมี Error เกิดขึ้น
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
//เรียกข้อมูลจาก ตาราง chart
//$get_data = $mysqli->query("SELECT * FROM report");
$get_data = $mysqli->query("SELECT COUNT(evaluation) as Numb,evaluation FROM report GROUP BY evaluation");
/*while($data = $get_data->fetch_assoc()){
$result[] = $data;
}*/
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>การใช้งาน Highcharts JS With PHP MySQL</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<h1>Hello, world! ข้อมูลทดสอบ</h1>
<table width="118%" class="table" id="datatable">
<thead>
<tr>
<th>งานที่</th>
<th>เวลาส่งเรื่อง</th>
<th>คนส่งเรื่อง</th>
<th>อาการเสีย11</th>
<th>เวลารับงาน</th>
<th>คนรับงาน</th>
<th>รอเวลา</th>
<th>คะแนน</th>
<th>จุดปฎิบัติงาน</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<?php
while($data = $get_data->fetch_assoc()){
echo"<tr>";
echo "<td>".$data['Numb']."</td>";
echo "<td>".$data['reqDate']."</td>";
echo "<td>".$data['reqID']."</td>";
echo "<td>".$data['reqReason']."</td>";
echo "<td>".$data['resDate']."</td>";
echo "<td>".$data['resID']."</td>";
echo "<td>".$data['resWaitting']."</td>";
echo "<td>".$data['evaluation']."</td>";
echo "<td>".$data['reqDept']."</td>";
echo "<td>".$data['comment']."</td>";
echo "<td>".$data['develop']."</td>";
echo"</tr>";
}
/*foreach($result as $result_tb){
echo"<tr>";
echo "<td>".$result_tb['idreport']."</td>";
echo "<td>".$result_tb['reqDate']."</td>";
echo "<td>".$result_tb['reqID']."</td>";
echo "<td>".$result_tb['reqReason']."</td>";
echo "<td>".$result_tb['resDate']."</td>";
echo "<td>".$result_tb['resID']."</td>";
echo "<td>".$result_tb['resWaitting']."</td>";
echo "<td>".$result_tb['evaluation']."</td>";
echo "<td>".$result_tb['reqDept']."</td>";
echo "<td>".$result_tb['comment']."</td>";
echo "<td>".$result_tb['develop']."</td>";
echo"</tr>";
}*/
?>
</tbody>
</table>
<script src="js/jquery-1.12.0.min.js"></script>
<script src="js/highcharts.js"></script>
<script src="modules/data.js"></script>
<script src="modules/exporting.js"></script>
<script>
$(function () {
$('#container').highcharts({
data: {
//กำหนดให้ ตรงกับ id ของ table ที่จะแสดงข้อมูล
table: 'datatable'
},
chart: {
type: 'column'
},
title: {
text: 'ข้อมูลจำนวนประชากรของแต่ละจังหวัด'
},
yAxis: {
allowDecimals: false,
title: {
text: 'Units'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
this.point.y; + ' ' + this.point.name.toLowerCase();
}
}
});
});
</script>
</body>
</html>