Registering multiple records by entering serial numbers once

Hi
I try to present the problem in a simple and clear way
Suppose we have a table in the database with these details:ID
brandID
ModelID
ColorID
serialNoNow I want to enter the information of a type of product once and enter all its serial numbers in one field (for example, in textarea, 20 separate serial numbers with a comma separator), to record 20 separate records.
Meanwhile, the uniqueness of these serial numbers should be checked and only non-repeating serial numbers (not repeat in this textarea and also not exist in database) should be recorded.
Do any friends have any suggestions?

  1. You may use Row_Updating/Inserting server event to set data for the serial number field.
  2. Since it is comma separated values, you need to parse it into array and check the uniqueness yourself, for example, you may read explode and array_unique.

I am not very familiar with PHPMaker code structure.
How can I access the variables containing the input values of the user entered fields?
For example, how can I access the value of the field “ModelID” or “SerialNo”?

You may see Row_Updating and Row_Inserting server event, the input are passed to the events as arguments.

OK, when I write my event code, “before insert”, Now I must dismiss inserting function, because I insert all of my data by my code.
In other hand , I must use “instead insert” situation not “before insert”.

Genius_Boy wrote:

For example, how can I access the value of the field “ModelID” or “SerialNo”?

You may use $rsnew[“ModelID”] and $rsnew[“SerialNo”] respectively to get those values in Row_Inserting server event.