Jump to content

Insert a lot into MySQL


NLCJ

Recommended Posts

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

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;

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.