Currently to check duplicates, the scripts checks fs the customer ID is existing in any of the rows and skips the record if it does. But however what I want to achieve is to check if the Customer ID exists and is mapped to the ProductIDs and append the unique product ID received via an HTML form post.
These customerIDs are imported into the DB via CSV sheet and the products are a checkbox which the user can select on the form where the csv file is uploaded, the values of the checkbox are posted as an array to the PHP script.
Table Name -> Customers There are 10 columns in the table, but the columns of interest to this question are 2.
- CustomerID
- ProductList
CustomerID | ProductID
CUS123 | 1,2,3
CUS234 | 2,3,1
CUS345 | 2,4,5
So what i want to do is, browse the csv sheet and:
- Check the customerID, if it exists, check the productIDs its mapped against, match it with the list of productIDs received in the array and check for the unique product IDs it's now mapped against, and append the same to the row.
Mapping of the elements of the array received from the HTML form with the array items in the ProductID column of the table is the challenge here.