| 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 = '192.168.1.7';
$database_port = '3333';
$database_username = 'root';
$database_password = '090407';
$database_name = 'mit';
$mysqli = new mysqli($database_host, $database_username, $database_password, $database_name, $database_port);
$mysqli->set_charset("utf8");
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
$get_user = $mysqli->query('SELECT userID,name,id FROM user where substr(userID,1,2)="IT"');
while($user = $get_user->fetch_assoc()){
$a_user[] = $user;
$get_data = $mysqli->query('SELECT resID,sum(evaluation) FROM report where resID ="'.$user['userID'].'"');
while($data = $get_data->fetch_assoc()){
$result[] = $data;
}
}
//$get_data = $mysqli->query("SELECT resID,sum(evaluation) FROM report GROUP BY ResID");
//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>ผลงาน IT</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/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>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<select name="ddlSelect" id="ddlSelect">
<option>- Select -</option>
<option value="CustomerID" <?if($_POST["ddlSelect"]=="resID"){echo"selected";}?>>resID</option>
<option value="Name" <?if($_POST["ddlSelect"]=="resDATE"){echo"selected";}?>>resDATE</option>
</select>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
</head>
<table class="table" id="datatable">
<thead>
<th>resID</th>
<th>sum(evaluation)</th>
</tr>
</thead>
<tbody>
<?php
foreach($result as $result_tb){
echo "<td>".$result_tb['resID']."</td>";
echo "<td>".$result_tb['sum(evaluation)']."</td>";
echo"</tr>";
}
?>
</tbody>
</table>
<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script>
$(function () {
$('#container').highcharts({
data: {
//กำหนดให้ ตรงกับ id ของ table ที่จะแสดงข้อมูล
table: 'datatable'
},
chart: {
type: 'column'
},
title: {
text: 'ตัวชี้วัดผลการปฏิบัติงาน'
},
yAxis: {
allowDecimals: false,
title: {
text: 'รวมคะแนน จากการประเมิน'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
this.point.y; + ' ' + this.point.name.toLowerCase();
}
}
});
});
</script>
</body>
</html>