PHP, MySQL CSV Import - How would you do this?

Shasta

New Member
So I'm working on a PHP project that needs to allow the user to import CSV files into MySQL. The CSV files contain a "column" with a unique ID... there are duplicates. Here is where the tricky part comes in... The duplicates need to go into a separate table and not into the main table. I have written code to do this but there has to be a more efficient way... Right now, the script reads the CSV and for each row, queries the db to see if the ID already exists, then puts it in the proper table. These CSV files contain 50k+ rows each so this gets to be extra time consuming... Any Idea's would be great! Thanks!
 
Top