popmotsy Posted March 19, 2009 Share Posted March 19, 2009 hii to all..... I wanna code to import and export csv file to mysql without using PHPMYADMIN,,,,,I wanna a code for that,,,can anyone help me out this problame.... :-[ thanks,,,,, Quote Link to comment https://forums.phpfreaks.com/topic/150120-solved-csv-to-mysql/ Share on other sites More sharing options...
Scorpy Posted March 19, 2009 Share Posted March 19, 2009 To save into a CSV: SELECT * INTO OUTFILE 'filename.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM ? To load from: LOAD DATA INFILE 'filename.csv' REPLACE INTO TABLE ? FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' The replace is optional, just depends if you want it to change existing rows. Quote Link to comment https://forums.phpfreaks.com/topic/150120-solved-csv-to-mysql/#findComment-788547 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.