如何一次将多个条目插入 MySQL 数据库

发布于 2024-08-06 02:18:32 字数 136 浏览 6 评论 0原文

我必须创建一个直方图/字典,其中包含解析 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天煞孤星 2024-08-13 02:18:32

只需一次插入多条记录,但是,如果其中一条出现错误,则整个插入将失败。

http://www.desilva.biz/mysql/insert.html

"INSERT INTO beautiful (name, age)
  VALUES
  ('Helen', 24),
  ('Katrina', 21),
  ('Samia', 22),
  ('Hui Ling', 25),
  ('Yumie', 29)";

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

"INSERT INTO beautiful (name, age)
  VALUES
  ('Helen', 24),
  ('Katrina', 21),
  ('Samia', 22),
  ('Hui Ling', 25),
  ('Yumie', 29)";
只涨不跌 2024-08-13 02:18:32

如果您有那么多条目,请创建一个文本文件并使用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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文