After your table and database
created you can take action for storing the data in database. Insert into
statement is used for creating new record in database with PHP Script. In this
command we can insert the data in database at run time. Here are some syntax
rules to follow.
- The SQL Query must be quoted in PHP.
- Numeric values must not allow.
- String values inside the SQL query must be quoted.
- The word NULL must not be quoted.
Syntax:
Insert into table_name (colume1, colume2, colume3) VALUES (value1, value2,
value3);
There are two methods for
defining insert into statement.
First method:
There is no column in database where data store.
Syntax:
Insert into table_name VALUES (value1,
value2, value3);
Second method:
There are both column and values available in database.
Syntax:
Insert into table_name (colume1, colume2, colume3) VALUES (value1, value2,
value3);