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
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;

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.