INSERT 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);
?>
Leave Comment