My function is an order import function, the data inside the XLS import into MySQL, each time around 1000.
Now the problem is that each record has a code, I have to check the coding system has not been built, built well, on the import, if not built on this whole batch are not imported system, how should I do??
Reply to discussion (solution)
Not understand, each record a code, but this code is not built well, how to a whole batch can not be imported, not this one can not import it?
If it is the one I want to not import, you can do this:
First read the 1000 data from the XLS file, at the same time read the Code table from the database, to encode the primary key to create an array, and then loop through your 1000 data, each time with this data encoding to find the encoding array in the existence, not exist then skip, the existence is saved into the database. Of course you can write SQL statements last-time save.
JZH2004, can you explain it in detail?
I say again, we will download an order from the Internet, is the daily sales order details, each record contains a material code, I do this page is to import the order details into a PHP ERP system, but sometimes the new material colleagues will forget in the ERP add up. I just want to make a judgment, first determine the order details inside these 1000 records, in the ERP system is not all have, as long as one does not have to stop the import.
It's nothing but trouble.
It's easy to implement, for each piece of content
First check if the encoding exists (select)
Reinsert (insert) based on results
Obviously your system uses a foreign key (it's self-made trouble for yourself)
In fact, direct insertion does not matter, it is not an error or insert invalid