Justman
|
| Posted: 01/12/2005, 4:08 PM |
|
Hi All,
I have a list box in an editable grid. And I want to confirm that each selection in the listbox has NOT been entered into the database before allow insert. This is to avoid double entry of the same value into a table.
My problem is how I can iterate through each listbox and compare the value against the one in the database if it exists.
global $myeditable_grid;
global $mysearch1;
global $DBconn;
$exits_c = CCDLookUp("product_id", "product_group", "product_id =". $DBconn->ToSQL($mysearch1->product_id->GetValue(), ccsInteger), $DBconn );
// HOW CAN I GET THE ARRAY NUMBER FOR EACH LISTBOX CONTROL AND EVALUATE THE VALUE AGAINST THE VALUE FROM THE DATABASE BEFORE ALLOW INSERT ?
foreach($exits_c..........) //ERROR
if (($exits_c == $myeditable_grid->product_id->GetValue())
{
$myeditable_grid->InsertAllowed = false;
$myeditable_grid->Errors->addError("Sorry ". $$exits_c . " is already in the system. You can't add it twice");
}
Any help would be highly appreciated. Thanks.
Justman
|
|
|
 |
|