46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<head>
|
|
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=utf-8">
|
|
</head>
|
|
|
|
<?php
|
|
date_default_timezone_set('Europe/Warsaw');
|
|
require_once("func.php");
|
|
require_once("dbaccess.php");
|
|
$polacz = mysql_connect($db_host, $db_user, $db_user_pass) or die ('cannot connect to db');
|
|
mysql_select_db($db_name);
|
|
mysql_query("SET NAMES utf8");
|
|
mysql_query("SET CHARACTER_SET utf8_general_ci");
|
|
|
|
|
|
unset($wellArray);
|
|
$wellArray = sqlGetResAsArray("select * from rep_clean_notrealiable");
|
|
//if(count($wellArray)>0)
|
|
for($i=0; $i<count($wellArray); $i++)
|
|
{
|
|
$del = 0;
|
|
|
|
unset($wellRecords);
|
|
$wellRecords = sqlGetResAsArray("select * from rep_his_data_everyday where RHD_Q_VAL>0 and RHD_DATE>='".$wellArray[$i]['CNT_AUDIT_DATE']."' and RHD_DRS_ID=".$wellArray[$i]['CNT_DRS_ID']);
|
|
|
|
for($w=0; $w<count($wellRecords); $w++)
|
|
{
|
|
unset($onOffArray);
|
|
$onOffArray = sqlGetResAsArray("select * from softspm_rep.rep_002_avg_pump_working where WST_ID=(select max(WST_ID) from softspm_rep.rep_002_avg_pump_working where WST_DRS_ID=".$wellArray[$i]['CNT_DRS_ID']." and WST_DATE<='".$wellRecords[$w]['RHD_DATE']."')");
|
|
|
|
if ($onOffArray[0]['WST_STATUS_VAL'] != 'ON')
|
|
{
|
|
//usuwa dane
|
|
mysql_query("DELETE FROM rep_his_data_everyday WHERE RHD_ID=".$wellRecords[$w]['RHD_ID']);
|
|
$del++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mysql_query("DELETE FROM rep_clean_notrealiable WHERE CNT_ID=".$wellArray[$i]['CNT_ID']);
|
|
echo'<br/>';
|
|
echo'Usunął '.$del. ' rekordy dla studni ID='.$wellArray[$i]['CNT_DRS_ID'].' <br/>';
|
|
}
|
|
|
|
mysql_close($polacz);
|