NLCJ Posted September 10, 2010 Share Posted September 10, 2010 Hello, Users can export information and paste it into a field at my site, this field will be formatted like: VALUE1,VALUE2,VALUE3,VALUE4 VALUE1,VALUE... I've gotten an answer on how-to count the lines, and I was thinking about doing it using a for loop, but somewhere in the past week I read something about BULK INSERT. I cannot find this anymore, and Google isn't helping. Does anyone know how to do this? And is it possible to run a check over it then? Regards, NLCJ Link to comment https://forums.phpfreaks.com/topic/213074-insert-a-lot-into-mysql/ Share on other sites More sharing options...
mikosiko Posted September 10, 2010 Share Posted September 10, 2010 no clear for me if you mean that the users export that content in a "field" or a CSV "file" both have totally different solutions/approach... will help if you post the table description where you want to insert those values. Link to comment https://forums.phpfreaks.com/topic/213074-insert-a-lot-into-mysql/#findComment-1109674 Share on other sites More sharing options...
fenway Posted September 11, 2010 Share Posted September 11, 2010 LOAD DATA FROM INFILE works wonders. Link to comment https://forums.phpfreaks.com/topic/213074-insert-a-lot-into-mysql/#findComment-1109844 Share on other sites More sharing options...
s0c0 Posted September 11, 2010 Share Posted September 11, 2010 Not to blatantly advertise my site, but I've found this is fastest way http://blog.cnizz.com/2010/05/31/faster-mass-sql-inserts-with-mysql-and-php/ to perform mass mysql inserts via PHP . Your other option (and the fastest option that I know of) is to use a mysql dump file and import directly from the MySQL command line or via PHPMyAdmin import tab. If from the MySQL shell your would just use the syntax below. Make sure you have first selected the database you want. mysql > use my_database; mysql > source /absolute-path/to/file.sql; Link to comment https://forums.phpfreaks.com/topic/213074-insert-a-lot-into-mysql/#findComment-1109937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.