• Have Any Question?
  • contact@eitworld.com

MySQLi Insert Data

  • Insert Into query is used to insert data into table. It would be more precise to say that this query is used to add new records in the database table.



INSERT INTO tableName(column1, column2…) VALUES (value1,value2…);
  • On execution of above query, the values will be added to their corresponding column. It is not necessary to write the column names in the same order as they are in the database table.


INSERT INTO tableName VALUES(value1,value2…);

In this syntax, column names are not defined. So the values will be inserted in the columns in same order as they appear in the database table.


  • These queries must be given as the second parameter of the function mysqli_query(). See the example.

<!DOCTYPE html>



$query=”INSERT INTO employee(id,name,salary,contact) VALUES(‘1′,’John’,’25000′,’7777777′)”;


$query=”INSERT INTO employee VALUES(‘2′,’Peter’,’40000′,’9999999′)”;






The table will look like:

id name salary contact
1 John 25000 7777777
2 Peter 40000 9999999
  • Above example clarifies both syntaxes. It will add two rows in the table emplayee of database firstdb.

Real Time Web Analytics