如何一次将多个条目插入 MySQL 数据库
我必须创建一个直方图/字典,其中包含解析 html 文件时找到的所有单词。这包括找到的所有单词的字典及其频率的直方图。
我想不出如何使用 PHP/MySQL 执行此操作,因为可能需要一次插入 2000 个单词。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需一次插入多条记录,但是,如果其中一条出现错误,则整个插入将失败。
http://www.desilva.biz/mysql/insert.html
Just insert multiple records at one time, but, if one has an error the entire insert will fail.
http://www.desilva.biz/mysql/insert.html
如果您有那么多条目,请创建一个文本文件并使用
LOAD DATA INFILE
命令。http://dev.mysql.com/doc/refman/ 5.1/en/load-data.html
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