//CENTER
if($posistion == "IND_34_CTR" || $posistion == "IND_CTR" || $posistion == "IND_30_CTR" || $posistion == "IND_83_CTR" || $posistion == "IND_85_CTR")
{
$month = date("Ym");
$sql1 = "SELECT * from `jos_onlinetime_CTR` where `CID`='$cid' && MONTH='$month'";
$s1result = mysql_query($sql1, $con) or die("There was an error with your query: $sql1". mysql_error());
$num_rows = mysql_num_rows($s1result);
if ($num_rows != "0") //determines if that user has that posistion already
{
$row = mysql_fetch_assoc($s1result);
If($row['LU'] == $logontime) //determines if its been updated for current session
{
$newtime = $row['TOTAL'] + 900; //Add 900 seconds to table (15 minutes, The duration between each update)
//INSERTS NEW TIME BACK INTO DATA
$uquery = "UPDATE `jos_onlinetime_CTR` SET
`TOTAL` = '$newtime',
`LU` = '$logontime' WHERE `CID`='$cid'";
mysql_query($uquery, $con) or die ("There was an error with your query: $uquery" . mysql_error());
}
If($row['LU'] != $logontime) //Determintes if they don't match
{
//Gets Current Time (in seconds)
$currenttime = gmmktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$duration = $currenttime - gmmktime($chour, $cmin, $csec, $cmonth, $cday, $cyear);
//INSERTS DIFFERENCE INTO TABLE
$newtime = ($row['TOTAL'] + $duration);
$uquery = "UPDATE `jos_onlinetime_CTR` SET
`TOTAL` = '$newtime',
`LU` = '$logontime' WHERE `CID`='$cid'";
mysql_query($uquery, $con) or die ("There was an error with your query: $uquery" . mysql_error());
}
}
if($num_rows == "0")
{
//Gets Current Time (in seconds)
$currenttime = gmmktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$duration = $currenttime - gmmktime($chour, $cmin, $csec, $cmonth, $cday, $cyear);
//creates new posistion in table
$nquery = "INSERT into jos_onlinetime_CTR(`CID`,`TOTAL`, `LU`, `MONTH`)VALUES('$cid', '$duration', '$logontime', '$month')";
mysql_query($nquery, $con) or die ("There was an error with your Query: $nquery" . mysql_error());
}
}
So heres my issue:
When a controller logs in as IND_34_CTR it works, but when they log in as IND_30_CTR it dosent record there time. Same goes for IND_CTR.
Now I have another table that is for an approach posistion. The if statement is the same with the exception of the posisition values are different and that table works fine. For some reason its just not accepting anything other than 34.
I've been trying to debug this for a couple days now. I figure it has to be something with the if statement.
A couple of notes:
1) I know that i spelled position incorrectly. However, I assure you its spelled incorrectly throughout the whole file lol.
2) if you would like to see the whole script its available here: http://zidartcc.pastebin.com/f741da96b
3) I know there aren't functions where there could be functions. Its only recently i've learned the value of a well written function (fairly new to the php thing)