Graphix author
Hi This is probably straight forward but I am still a newbie as far as PHP is concerned <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=21949&image=1&table=forumtopics' class='bbc_emoticon' alt=':unsure:' />
I have created an app that records Bromine levels at a factory every hour if the levels are between a certain range a 'action' log must be added to the record values are <10 or >30 the problem I have is if a certain process is 'Offline' obviously the value is 0 these processes go offline on a regular basis for cleaning so no Action log is required if the process is offline, what is happening is the action log is filling up with nonsense data all zeros how can I amend the below code to exit and not run if a process is set to 'offline' I have a status field of online and offline if the user selects offline I don't want the 'after record process' to run simply just exit but cannot work out how to do it. it took me a rather long time to write and get the below code working I don't want to mess it up LOL
if (($values["M&W2"] < 10) OR ($values["M&W2"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "M&W2" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["M&W2"]."',`notes`= '".$values["M&W_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["FMC3"] < 10) OR ($values["FMC3"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "FMC3" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["FMC3"]."',`notes`= '".$values["FMC3_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["Stork3Out"] < 10) OR ($values["Stork3Out"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "Stork 3 Out" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["Stork3Out"]."',`notes`= '".$values["ST3O_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["Stork2"] < 10) OR ($values["Stork2"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "Stork 2" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["Stork2"]."',`notes`= '".$values["ST2_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["FMC4"] < 10) OR ($values["FMC4"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "FMC4" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["FMC4"]."',`notes`= '".$values["FMC4_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["Molenaar"] < 10) OR ($values["Molenaar"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "Molenaar" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["Molenaar"]."',`notes`= '".$values["MOL_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["Stork4"] < 10) OR ($values["Stork4"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "Stork 4" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["Stork4"]."',`notes`= '".$values["ST4_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["FMC2"] < 10) OR ($values["FMC2"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "FMC2" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["FMC2"]."',`notes`= '".$values["FMC2_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["Stork1"] < 10) OR ($values["Stork1"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "Stork 1" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["Stork1"]."',`notes`= '".$values["ST1_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} if (($values["Reservoir"] < 10) OR ($values["Reservoir"] > 30))
{
global $conn;
$strSQLSave = "INSERT INTO `ad_actions` SET `sampledate`= '".$values["sample_date"]."',
`sampletime`= '".$values["sample_time"]."',`site`= '".$values["site"]."',`tested`= '". "Reservoir" ."',`Asset`= '". "Bromine Levels" ."',
`result`= '".$values["Reservoir"]."',`notes`= '".$values["RES_ACTION"]."',
`name`= '".$values["user"]."' " ;
db_exec($strSQLSave,$conn);
} thank you in advance
Kevan
|
|