我想从一个excel文件中插入mysql数据表值,在php中。我搜索了很多,但没有一个工作。 excel表是这样的: The excel file which i want to upload it to mysql
答案 0 :(得分:0)
我建议以csv格式保存文件并使用“加载数据infile”上传
检查mysql文档here
CREATE TABLE sample
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
rollno INT,
admnno INT,
name varchar(50),
dob Date,
classid INT,
guardian varchar(50),
contactno INT
);
LOAD DATA INFILE '/tmp/sample.csv'
INTO TABLE sample
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'