Ah, well! TheBeginner you didn't say that columns would be missing. However you should be aware of this:
---- quote -----
When loading a table from a text file, use LOAD DATA INFILE. This is usually 20 times faster than using a lot of INSERT statements. See section 14.1.5 LOAD DATA INFILE Syntax.
(from: http://dev.mysql.com/doc/mysql/en/Insert_speed.html)
----- end quote -----
Now, I come from a mainstream database background, ie Oracle, Access, SQLServer rather than CGI and web programming; and I have noticed that the preferance around here is for code solution for what I see a simple database and sql problems. I'm also ingrained with the Need for Speed: which is always achieved through sql queries as opposed to script code - that is what the quote above is all about.
In this case, missing columns are no problem. A CSV should have field delimiters and record delimiters: your missing field should just be 2 commas with nothing in between :-
var1,var2,var3,var4,var5,
var1,var2,var3,var4,,
var1,var2,var3,var4,var5
So an import to a table is only a problem if the missing field is specified as NOT NULL.
So, if time does not matter to you, and you prefer to write complex scripts, then by all means use fgetcsv.
Personally, I believe that the correct tool should always be used.
I also beleive that the best contribution I can make to this forum is my extensive backend DB experience, in exchange for all the php help that I am getting out.