Many times you will want to load a csv file into a database. If your table is the same structure as the csv file there are some very quick ways to load the file into the db with out having to load it into an array and do foreach loops for each row. The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. The file name must be given as a literal string.
Sometimes when exporting from a windose machine you will need to use the code below. Windows is bad about inserting poorly formated line breaks.