Code: Select all
function checklist_before_insert(&$data, $memberInfo, &$args) {
// WORK OUT MONTH YEAR
$UKDate=$_REQUEST['DateLeavingMonth'].$_REQUEST['DateLeavingYear'];
// set up unique check
$Uk=$data['EMPLOYEEID'].$UKDate;
// list the unique keys in an array
$res = sql("SELECT Unique_Check_Value FROM checklist",$eo);
WHILE($row = db_fetch_row($res)){
$uks[]=$row[0];
}
// if unique key already exists do not save the record
IF(in_array($Uk, $uks)){
return FALSE;
}else{
return TRUE;
}
}