Home >Backend Development >PHP Tutorial >How to insert a bunch of data into the database in batches?

How to insert a bunch of data into the database in batches?

WBOY
WBOYOriginal
2016-07-06 13:53:581080browse

To make test data, I found a bunch of names and IPs from the Internet. How should I store them in the database? !

Reply content:

To make test data, I found a bunch of names and IPs from the Internet. How should I store them in the database? !

I will give you a rough idea:
1. Use PHP’s file processing function to read the file line by line and get a large array
2. Use a foreach loop to insert mysql and it will be OK

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn