jim7567g
Posts: 38
|
| Posted: 02/05/2005, 8:15 AM |
|
Hello, I have the following custom code set in the "Before Insert" section.
//Custom Code @175-9470612E
// -------------------------
global $production_hours1;
$userlog = CCGetFromPost("user_login", "");
$gettimestamp = CCGetFromPost("week_time_stamp", "");
$timestamp = strtotime($gettimestamp);
$year = date('Y', $timestamp);
$weeknum = date('W', $timestamp);
$together = $userlog . $weeknum . $year;
$production_hours1->unique_id->SetValue($together);
global $DBvestora_production;
global $check;
$result = CCDLookUp("unique_id", "production_hours", "unique_id='". $together . "'", $DBvestora_production);
$result = strval($result);
$check = $result;
if ($check == $together)
{
$production_hours1->unique_id->Errors->addError("Duplicate Entry");
}
// -------------------------
//End Custom Code
I am concerned about the last few lines of this code where I am performing a unique entry check. The check is working correctly and I am getting the error message returned to the browser that there is a duplicate entry but I have not been able to figure out how stop the insert.
Should I be using this code in another events section?
_________________
Jim |