Insert into is used to insert records in mysql. However, to insert multiple records, insert into or other methods are used to traverse and execute insert into. Let's take a look.
Normally, we use SQL to execute
Insert into 'tabale '('name') VALUE ('name ')
If you want to use php to execute such an SQL statement, you need to execute the following SQL statement to insert multiple rows of records.
Insert into 'tabale '('name') VALUE ('name'), ('name ')
You want to insert more than one entry at a time.
If you want to insert five records into Table 1, the following statement is incorrect:
Insert into table1 (I) VALUES (1, 2, 3, 4, 5 );
MySQL will throw the following error
ERROR 1136: Column count doesn't match value count at row 1
The correct statement is as follows:
Insert into t able1 (I) VALUES (1), (2), (3), (4), (5 );
Of course, this statement can also omit the column name, so that the number of values in each pair of brackets must be consistent, and this number must be consistent with the number of columns. For example:
Insert into t able1 VALUES (1), (2), (3), (4), (5 );