I’ve created a script to read data exported as a Microsoft Excel CSV / tab-delimited text file , directly into a database using LOAD DATA INFILE.

It works great if the data from the original spreadsheet is properly written, but that’s of course not the case, and it’s been causing massive errors when the spreadsheets are poorly made.

I need a way to filter the data before importing it into the database. Is there a way to do that?


de rien, my friend :cool:


You just gave me an idea though. I’ll LOAD DATA into a temporary table, run the PHP filters on it there, then merge it with the main table afterward.

As I’m here, is there a simple MySQL query to add all data from one table to another? Or would I have to make a PHP loop to add the records one by one?

Thanks much.


there sure is

  INTO table2
     ( foo, bar, fap )
SELECT boo, far, bap
  FROM table1

[FONT=“Georgia”]Okay, it’s done.

Seems to be working now.

Thanks, dread.


How, precisely, does one ‘poorly make’ a CSV? Putting commas in the file? What are you using to execute the queries?

yeah, but not with mysql (obviously)

so maybe you should ask this thread to be moved to the forum for whatever language you wrote your script in? just click on da little orange flag…