---
title: "Inserting Record in MySQL database Table using PHP"  
description: "INSERT INTO Statement is used to insert new record into table.  Syntax:INSERTINTO table_Name (  column_name1, column_name2, .....column_nameN)   VALUE"  
author: "Anonymous User"  
published: 2011-09-21  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/737/inserting-record-in-mysql-database-table-using-php  
category: "php"  
tags: ["php"]  
reading_time: 1 minute  

---

# Inserting Record in MySQL database Table using PHP

[INSERT](https://www.mindstick.com/articles/81/insert-update-delete-records-in-csharp-dot-net) INTO Statement is used to insert new record into table.\

##### Syntax:

```
INSERTINTO table_Name (  column_name1, column_name2, .....column_nameN)   VALUES (value1,  value2,........valueN)
```

##### Example:

```
<?php      //  creatingconnection with mysql database server      $con = mysql_connect("localhost", "root", "root");    // check connection is establish or not    if(!$con)    {        die ("Connectionnot established!  Please try again");    }      //Selecting databse     mysql_select_db("TempDatabase",$con);      //  Insertingrecord into tblTemp    $qry = "INSERT INTO tblTemp             VALUES            (                '102',                'Singh',                'xyz@pqr.com',                'Hn-xyz pqr ',                '000000000'            )";      //  Executingquery in MySql database server     if(mysql_query($qry,$con))     {         echo 'Record inserted successfully.'.'</br>';    }     else    {         echo 'Record insertion failed ! ';    }      //Closingthe connection     mysql_close($con);?>
```

##### Output:

![Inserting Record in MySQL database Table using PHP](https://www.mindstick.com/mindstickarticle/b57d73ff-9b86-4869-9e22-6f07d3ab39d7/images/6205bf73-a046-48a8-9199-aee72f348787.png)

\

---

Original Source: https://www.mindstick.com/articles/737/inserting-record-in-mysql-database-table-using-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
