/* 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 '
';
echo $msgid .'
';
echo $entity .'
';
echo $cquery .'
';
echo substr($crow[0], 0, 2) .'
';
echo strtoupper($type) .'
';
echo '
';
echo '