What i am trying to do is to extract data from mysql table into a .CSV file and then after editing upload it again to update my DB.

I am planning on using php but i at the time dont know which command will convert mysql table into .CSV and insert/overide the old info in the table from CSV.

Recommended Answers

All 2 Replies

from mysql docs under the SELECT syntax:

SELECT a,b,a+b INTO OUTFILE '/tmp/result.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM test_table;

Then you can use the LOAD DATA syntax:

LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n';

HTH

Thanks, That helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.