Search code examples
mysqldictionaryinsertload-data-infilehistogram

How do I INSERT multiple entries at once into an MySQL database


I have to create a histogram/dictionary of all words found in parsing an html file. This includes a dictionary of all words found, and a histogram of their frequency.

I can't think of how to do this with PHP/MySQL because there could be potentially 2000 words that would have to be inserted at once.

Any ideas?


Solution

  • If you have that many entries, create a text file and use the LOAD DATA INFILE command.

    http://dev.mysql.com/doc/refman/5.1/en/load-data.html