read second row of csv file using php

Anyone know how to read a second row of a csv file using PHP?
 I want to import only starting from second row onwards of the csv file into mysql.
redcoderAsked:
Who is Participating?
 
steelseth12Connect With a Mentor Commented:
Remove the signle colons from the table name

mysql_query("LOAD DATA INFILE 'vehicledata.csv' INTO TABLE vehicledatatemp FIELDS TERMINATED BY ',' IGNORE 2 LINES ");    

and use a full path to your csv file

if your csv file is in the same directory are you php file you can do

mysql_query("LOAD DATA INFILE '".dirname($_SERVER['SCRIPT_FILENAME'])."/vehicledata.csv' INTO TABLE vehicledatatemp FIELDS TERMINATED BY ',' IGNORE 2 LINES ");
0
 
steelseth12Commented:
LOAD DATA INFILE 'pathtocvsfile' INTO TABLE tablename IGNORE 2 LINES;

For more info look at http://dev.mysql.com/doc/refman/5.0/en/load-data.html
0
 
redcoderAuthor Commented:
Is it possible to use those command with php? I tried with :

mysql_query("LOAD DATA INFILE 'vehicledata.csv' INTO TABLE 'vehicledatatemp' FIELDS TERMINATED BY ',' IGNORE 2 LINES ");    

 in php but it doesn't work
0
 
redcoderAuthor Commented:
great. that really works.

 you are great steelseth12..

:-)

0
 
steelseth12Commented:
Glad i could help.
Thank you for the points and the grade.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.