MySQL Insert Multiple

MySQL Insert Multiple


PHP MySQL Insert Multiple Records:

Insert is the process of inserting data into the table. INSERT statement adds new rows into already present table. The present chapter “PHP Insert Multiple Records Into MySQL” shows how to insert various records into the Database.

Multiple SQL statements uses mysqli_multi_query() function to execute.

If a string data types to be inserted, double or single quotes are to be used.

When adding a new row,the datatype of the value and the column should match

Let's understand with given below example how to add multiple records in table.

Example (MySQLi Object-oriented):

Output :

Example (MySQLi Procedural):

Output :

The PDO way is a little bit different:

Example (PDO)

Output: