<?php
if(function_exists('date_default_timezone_set')) date_default_timezone_set('Asia/Jakarta');

$server="localhost"; $user="sdatelem_icuadm"; $pass="Icupu2015"; $db="sdatelem_icu";
$con_project=mysql_connect($server, $user, $pass);
$db_project=mysql_select_db($db,$con_project);

$hrini=date('Y-m-d');
$jamini=date('H:00:00');
//echo "<br />";
$jamdualalu=date('H:00:00')-5;
//echo "<br />";
$duajam="0".$jamdualalu.":00:00";
$query_lokasi=mysql_query("select * from lumbir WHERE ReceivedDate='".$hrini."'",$con_project);
$i=0;
while($rl=mysql_fetch_array($query_lokasi)){
	$i++;
	if($i%2==0){
	echo $insert="INSERT IGNORE into cigaleuh values ('','".$hrini."','".$rl['ReceivedTime']."','".$hrini."','".$rl['SamplingTime']."','".$rl['Rain']."','".$i."','".$rl['ML']."','".$rl['Temperature']."','".$rl['Humidity']."')";
	echo "<br>";
	$queryUp=mysql_query($insert);
	}
}
?>