| Server IP : 134.236.49.22 / Your IP : 216.73.216.114 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/water/ |
Upload File : |
<?php
session_start();
if (isset($_GET['frd'])){ //กำหนดวันที่ &frd=01/12/2021&tod=31/12/2021
//echo $_GET['frd'].'<br>';
$UfromDate = $_GET['frd']; ;
if (isset($_GET['tod'])) $UtoDate = $_GET['tod'];
else $UtoDate = $UfromDate;
}else{ //ไม่กำหนดวันที่ ให้แสดงของเดือนนั้นๆ 01/12/2021 - 31/12/2021
$UfromDate = date('01/m/Y',time());
$UtoDate = date('t/m/Y',time());
}
if (isset($_POST['submit'])){
if ($_POST['submit']=="แสดง"){
$UfromDate =trim($_POST['DateFr']) ; //$_POST['DateFr']=01/01/2564
$UtoDate =trim($_POST['DateTo'] );
$UfromDate = substr($UfromDate,0,6).substr('0000'.trim(substr($UfromDate,6,4)-543) ,-4);//$UfromDate ='01/01/2021'
$UtoDate = substr($UtoDate,0,6). substr('0000'.trim(substr($UtoDate,6,4)-543) ,-4);
}
}
$end_date = substr($UtoDate,6,4).'-'.substr($UtoDate,3,2).'-'.substr($UtoDate,0,2);
$start_date = substr($UfromDate,6,4).'-'.substr($UfromDate,3,2).'-'.substr($UfromDate,0,2);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>คุณภาพน้ำ</title>
<script src="jquery-2.1.3.min.js"></script>
<link href="bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet" />
<link href="bootstrap-3.3.7-dist/css/bootstrap-theme.css" rel="stylesheet" />
<script src="bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<link href="dist/css/bootstrap-datepicker.css" rel="stylesheet" />
<script src="dist/js/bootstrap-datepicker-custom.js"></script>
<script src="dist/locales/bootstrap-datepicker.th.min.js" charset="UTF-8"></script>
<script>
$(document).ready(function () {
$('.thdatepicker').datepicker({
format: 'dd/mm/yyyy',
todayBtn: true,
language: 'th', //เปลี่ยน label ต่างของ ปฏิทิน ให้เป็น ภาษาไทย (ต้องใช้ไฟล์ bootstrap-datepicker.th.min.js นี้ด้วย)
thaiyear: true //Set เป็นปี พ.ศ.
}).datepicker("setDate"); //กำหนดเป็นวันปัจุบัน
});
</script>
<script type="text/javascript">
function getValue(vname) {
var n = document.getElementById(vname).value
return n;
}
</script>
<style type="text/css">
@media print{
#hid{
display: none; /* ซ่อน */
}
#submit{
display: none; /* ซ่อน */
}
}
</style>
</head>
<body>
<table width="100%" border="0" align="center">
<tr>
<td align="center">รายงานการบันทึกผลการตรวจน้ำประจำวัน </td>
</tr>
</table>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p align="center"><br><label for="DateFr" >ระหว่างวันที่</label>
<input name="DateFr" id="DateFr" class="thdatepicker" onKeyPress="event.returnValue = false;" size="10" width = "20px" data-date-format="mm/dd/yyyy" value = "<?php echo $UfromDate ; ?>" />
<label for="DateTo" >ถึงวันที่</label>
<input name="DateTo" id="DateTo" class="thdatepicker" onKeyPress="event.returnValue = false;" size="10" width = "20px" data-date-format="mm/dd/yyyy" value = " <?php echo $UtoDate ; ?>" />
<input type="submit" value="แสดง" id="submit" name="submit" >
</p>
</form>
<?php
$month_arr= Array("","ม.ค." , "ก.พ." , "มี.ค." , "เม.ย." , "พ.ค." , "มิ.ย." , "ก.ค." , "ส.ค." , "ก.ย." , "ต.ค." ,"พ.ย." , "ธ.ค." );
$objConnect = mysql_connect("localhost","root","090407") or die("Error Connect to Database");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$objDB = mysql_select_db("water");
$strSQL = "SELECT * FROM water_check where substr(date_check,1,10)>='".$start_date."' AND substr(date_check,1,10)<='".$end_date."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="100%" border="1" align="center">
<tr bgcolor="#CCCCCC">
<th width="18%"align="center"><span class="style2">วันที่บันทึก </span></th>
<th width="20%"align="center"><span class="style2">ค่าตะกอน (SV<sub>30</sub>)</span></th>
<th width="20%"align="center"><span class="style2">ค่าออกซิเจนในน้ำ (DO) </span></th>
<th width="18%"align="center"><span class="style2">ค่าปริมาณคลอรีนคงเหลือ </span></th>
<th width="25%"align="center"><span class="style2">ค่าความเป็นกรด - ด่าง (pH) </span></th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
$month_m = substr($objResult["date_check"],5,2);
$date_show =substr($objResult["date_check"],8,2).' '.$month_arr[(int)$month_m].' '.(substr($objResult["date_check"],0,4)+543).' '.substr($objResult["date_check"],11,5);
?>
<tr>
<td align="center"><span class="style2"><?php echo $date_show;?></span></td>
<td align="center"><span class="style2"><?php echo $objResult["sediment"];?></span></td>
<td align="center"><span class="style2"><?php echo $objResult["oxygen"];?></span></td>
<td align="center"><span class="style2"><?php echo $objResult["chlorine"];?></span></td>
<td align="center"><span class="style2"><?php echo $objResult["acidity"];?></span></td>
</tr>
<?php
}
?>
</table>
<?php
mysql_close($objConnect);
?>
</body>
</html>