Initial commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
require_once('./func.php');
|
||||
require_once('./dbaccess.php');
|
||||
require_once('./polynomial/math.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");
|
||||
|
||||
echo"START: ".date('Y-m-d H:i:m')."<br/>";
|
||||
|
||||
$groupArray = sqlGetResAsArray("select DRS_SN_NUMBER, count(DRS_SN_NUMBER) ILE from seg_dev_resources where DRS_DEV_TYPE=11 group by DRS_SN_NUMBER,DRS_AUDIT_USR having count(DRS_SN_NUMBER)>2");
|
||||
for ($i=0; $i<count($groupArray); $i++)
|
||||
{
|
||||
echo'SN: '.$groupArray[$i]['DRS_SN_NUMBER'].'<br/>';
|
||||
|
||||
unset($arrayCompare);
|
||||
|
||||
unset($stmotArray);
|
||||
$stmotArray = sqlGetResAsArray("select * from stp_stamot where stp_stamot_nr_m='".$groupArray[$i]['DRS_SN_NUMBER']."'");
|
||||
for ($i1=0; $i1<count($stmotArray); $i1++)
|
||||
{
|
||||
unset($engOK);
|
||||
$engOK = sqlGetResAsArray("select * from seg_engines where ENG_NAME='".$stmotArray[$i1]['stp_stamot_typ_m']."' and ENG_VOLTAGE='".$stmotArray[$i1]['stp_stamot_u']."'");
|
||||
|
||||
if ($engOK[0]['ENG_ID']>0)
|
||||
{
|
||||
$arrayCompare[] = array(
|
||||
'id' => $engOK[0]['ENG_ID']
|
||||
);
|
||||
|
||||
echo 'eng_id: '.$engOK[0]['ENG_ID'].'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
echo'======================= ENG ID ================================================<br>';
|
||||
|
||||
unset($engDelArray);
|
||||
$engDelArray = sqlGetResAsArray("select * from seg_dev_resources where DRS_SN_NUMBER='".$groupArray[$i]['DRS_SN_NUMBER']."'");
|
||||
for ($i2=0; $i2<count($engDelArray); $i2++)
|
||||
{
|
||||
$licznik=0;
|
||||
|
||||
for ($i3=0; $i3<count($arrayCompare); $i3++)
|
||||
{
|
||||
if ($engDelArray[$i2]['DRS_DEV_ID'] == $arrayCompare[$i3]['id'])
|
||||
{
|
||||
$licznik++;
|
||||
}
|
||||
}
|
||||
|
||||
// jeżeli nie znalazł - usuwa
|
||||
if ($licznik==0)
|
||||
{
|
||||
mysql_query("DELETE FROM softspm.seg_dev_resources WHERE DRS_ID=".$engDelArray[$i2]['DRS_ID']);
|
||||
echo("DELETE FROM softspm.seg_dev_resources WHERE DRS_ID=".$engDelArray[$i2]['DRS_ID']);
|
||||
echo';<br>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo'==============================================================================';
|
||||
echo'<br>';
|
||||
echo'<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo"STOP: ".date('Y-m-d H:i:m')."<br/>";
|
||||
mysql_close($polacz);
|
||||
?>
|
||||
Reference in New Issue
Block a user