Im using mysql and Php
I tried several times but always didnt insert data. please help me to do this.
I have MySQL table called 'db_master'. 'ID' feild is a开发者_JAVA百科uto increment
this is my table
and i have csv file called 'csv_master' - no column headings..
this is my csv file -
please help me to input CSV file my table (db_master) - PHP CODE REQUIRED
thanks in advance.
LOAD DATA INFILE 'my_file.csv'
INTO TABLE db_master(destination, bay, shipInvoiceNumber, invoiceNumber, start, end);
MySQL has support for loading CSV data using the Load Data command. You can find more help here.
I noticed that you have an additional problem though. Your CSV file has fewer columns than your table - you may want to fix that first.
Chris
mysql> LOAD DATA LOCAL INFILE './csv_master.csv' INTO TABLE your_db.db_master FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
精彩评论