105 lines
3.5 KiB
PHP
105 lines
3.5 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="pl">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<!-- Bootstrap -->
|
|
|
|
<meta http-equiv="Refresh" content="1" />
|
|
|
|
</head>
|
|
<body>
|
|
|
|
|
|
<?php
|
|
date_default_timezone_set('Europe/Warsaw');
|
|
require_once("func.php");
|
|
$con = mysql_connect('localhost', 'root', 'visia2209');mysql_select_db('test');
|
|
|
|
mysql_query("SET NAMES utf8");
|
|
mysql_query("SET CHARACTER_SET utf8_general_ci");
|
|
|
|
unset($wellArray);
|
|
$wellArray = sqlGetResAsArray("select * from all_wells where STATUS=0 limit 1");
|
|
|
|
echo $wellArray[0]['WELL'];
|
|
echo"<br/><br/>";
|
|
|
|
|
|
unset($array_01);
|
|
$array_01 = sqlGetResAsArray("select * from all_well_date where WELL='".$wellArray[0]['WELL']."'");
|
|
for ($i=0; $i<count($array_01); $i++)
|
|
{
|
|
|
|
unset($array_02);
|
|
$array_02 = sqlGetResAsArray("
|
|
select * from `1` where `WELL`='".$wellArray[0]['WELL']."' and `DATE_TIME`='".$array_01[$i]['DATE_TIME']."' and `TYPE` in ('spm:I1','spm:P','spm:p1','spm:p2','spm:Tw','spm:U12','spm:V','spm:Hd','spm:Hs','spm:Q')
|
|
union
|
|
select * from `2` where `WELL`='".$wellArray[0]['WELL']."' and `DATE_TIME`='".$array_01[$i]['DATE_TIME']."' and `TYPE` in ('spm:I1','spm:P','spm:p1','spm:p2','spm:Tw','spm:U12','spm:V','spm:Hd','spm:Hs','spm:Q')
|
|
union
|
|
select * from `3` where `WELL`='".$wellArray[0]['WELL']."' and `DATE_TIME`='".$array_01[$i]['DATE_TIME']."' and `TYPE` in ('spm:I1','spm:P','spm:p1','spm:p2','spm:Tw','spm:U12','spm:V','spm:Hd','spm:Hs','spm:Q')
|
|
union
|
|
select * from `4` where `WELL`='".$wellArray[0]['WELL']."' and `DATE_TIME`='".$array_01[$i]['DATE_TIME']."' and `TYPE` in ('spm:I1','spm:P','spm:p1','spm:p2','spm:Tw','spm:U12','spm:V','spm:Hd','spm:Hs','spm:Q')
|
|
union
|
|
select * from `5` where `WELL`='".$wellArray[0]['WELL']."' and `DATE_TIME`='".$array_01[$i]['DATE_TIME']."' and `TYPE` in ('spm:I1','spm:P','spm:p1','spm:p2','spm:Tw','spm:U12','spm:V','spm:Hd','spm:Hs','spm:Q')
|
|
");
|
|
|
|
|
|
if (count($array_02)>0)
|
|
{
|
|
unset($spmI1); unset($spmP); unset($spmp1); unset($spmp2); unset($spmTw); unset($spmU12); unset($spmV);
|
|
unset($spmHd); unset($spmHs); unset($spmQ);
|
|
|
|
|
|
for ($j=0; $j<count($array_02); $j++)
|
|
{
|
|
|
|
if ($array_02[$j]['TYPE']=='spm:I1') $spmI1 = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:P') $spmP = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:p1') $spmp1 = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:p2') $spmp2 = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:Tw') $spmTw = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:U12') $spmU12 = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:V') $spmV = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:Hd') $spmHd = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:Hs') $spmHs = $array_02[$j]['VALUE'];
|
|
elseif ($array_02[$j]['TYPE']=='spm:Q') $spmQ = $array_02[$j]['VALUE'];
|
|
}
|
|
|
|
if ($spmQ>0)
|
|
{
|
|
$spmQ = round($spmQ*60,3);
|
|
mysql_query("INSERT INTO all_well_measurment SET WELL='".$wellArray[0]['WELL']."'
|
|
,DATE_TIME='".$array_01[$i]['DATE_TIME']."'
|
|
,WLM_I1='".$spmI1."'
|
|
,WLM_P='".$spmP."'
|
|
,WLM_p1='".$spmp1."'
|
|
,WLM_p2='".$spmp2."'
|
|
,WLM_Tw='".$spmTw."'
|
|
,WLM_U12='".$spmU12."'
|
|
,WLM_V='".$spmV."'
|
|
,WLM_Hd='".$spmHd."'
|
|
,WLM_Hs='".$spmHs."'
|
|
,WLM_Q='".$spmQ."'
|
|
");
|
|
|
|
echo"Wstawił Q= ".$spmQ."<br/>";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mysql_query("UPDATE all_wells SET STATUS=1 WHERE WELL='".$wellArray[0]['WELL']."'");
|
|
|
|
mysql_close($con);
|
|
|
|
|
|
|
|
?>
|