/* Check to see if they're already clocked in */ $cquery = "SELECT STATUS FROM `tbl_employee_clock_time` WHERE "; $cquery .= sprintf("ID_EMPLOYEE = %s AND ENTITY_ID = %s ", mysql_real_escape_string($msgid), mysql_real_escape_string($entity)); $cquery .= " AND ID IN (SELECT MAX(ID) FROM `tbl_employee_clock_time` "; $cquery .= sprintf("WHERE ID_EMPLOYEE = %s AND ENTITY_ID = %s )", mysql_real_escape_string($msgid), mysql_real_escape_string($entity)); $cresults = mysql_query($cquery); $crow = mysql_fetch_row($cresults); echo '<br />'; echo $msgid .'<br />'; echo $entity .'<br />'; echo $cquery .'<br />'; echo substr($crow[0], 0, 2) .'<br />'; echo strtoupper($type) .'<br />'; echo '<br />'; echo '<h3>'; /* Check to see if the last record matches the current on $type */ if (strtoupper($type) === "IN") { if (substr($crow[0], 0, 2) === "IN") { echo 'You are either already clocked in, or you forgot to clock out from the previous day. Please contact a supervisor.'; echo '<br /><br /><a href="clock.php"><h3>Return</h3></a>'; exit(); } else { echo ''; } } if (strtoupper($type) === "OUT") { if (substr($crow[0], 0, 3) === "OUT") { echo 'You are either already clocked out, or you forgot to clock in today. Please contact a supervisor.'; echo '<br /><br /><a href="clock.php"><h3>Return</h3></a>'; exit(); } }