PHP MySQL Insert - Php Mysql Create Database - Phptpoint.com

PHP MySQL Insert

/ins>

PHP MySQL Insert Query

The INSERT INTO statement is used to add new records to a database table.

The insert statement is used to add new records to a database table. each time a new record is to be added we use INSERT INTO statement for that purpose.

There are two ways of inserting records either explicitly providing the column name with values respectively or simply by providing values of table but doesn’t specify the column name.

Syntax

The second way doesn’t specify the column names where the data will be inserted, only their values

Syntax

Ex

In the previous chapter we created a table named “empInfo”, with four columns; “emp_id”, “name”, “emailid” and “mobile”. Use the same table to insert values inside empInfo table.

HTML Form

In the above example the values such as name , eid , mobile number are fetched from the
form and inserted into empInfo table using INSERT INTO query.

Insert data from HTML form directly in database

HTML Form

In the above example values such as name , eid , mobile number are fetched from the
form and inserted into empInfo table without providing the column names