-3

I want to insert mysql data table values from a excel file , in php.I googled a lot for it and none of them worked . The excel table is like this: The excel file which i want to upload it to mysql

Shinoy p b
  • 353
  • 3
  • 13

1 Answers1

0

I would suggest save the file in csv format and upload using "Load data infile"

check the mysql documentation 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'
Shuchi Sethi
  • 683
  • 7
  • 13