开发者

Using MYSQL Load Data with TXT file, need to ignore first line

开发者 https://www.devze.com 2023-02-28 21:44 出处:网络
I have a PHP script setup to receive a CSV file. I\'m using the \'LOAD DATA INFI开发者_如何学JAVALE.. REPLACE\' function to read it into a table.

I have a PHP script setup to receive a CSV file.

I'm using the 'LOAD DATA INFI开发者_如何学JAVALE.. REPLACE' function to read it into a table.

But I need to ignore the first line of the file, whats the most efficient way to do that?

The csv is < 100kb, around 350-400 lines


The most efficient way for 'LOAD DATA INFILE' is to use 'IGNORE number LINES' clause.

LOAD DATA INFILE Syntax

e.g. LOAD DATA INFILE 'data.csv' INTO TABLE table1 IGNORE 1 LINES;


You can use the fgetcsv function?

0

精彩评论

暂无评论...
验证码 换一张
取 消