lundi 27 juillet 2020

how to check dublicate entry in a coloum in csv file . Can you tell me whats wrong with the code

i tried this code but when i upload a csv file even if it has no duplicate entries it show me it contain dublicates.

$chkDuplicate = false;
                        $inner_row = 0;
                        //check duplicate value on csv
                        foreach ($imported_data as $inner_key => $inner_value) 
                        {
                            if ($key != $inner_key && $product_imei == trim($inner_value[1])) {
                                $chkDuplicate = true;
                                $inner_row = $inner_key + 1;
                            }
                           
                        }

                        if ($chkDuplicate) 

                        {
                            $is_valid = false;
                            $error_msg = "Same PRODUCT IMEI in row no. $row_no and row no. $inner_row ";
                            break;
                        } 


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire