- About
- About
- Basic syntax
- Comments in php
- Variable
- Operators
- Constant
- PHP Decision Making
- PHP Loops
- PHP Function
- PHP Arrays
- PHP Superglobals
- PHP Forms
- PHP Form Handling
- PHP MySql Database
- MySql Introduction
- MySql Connect
- MySql Create Db/Table
- MySql Inserting Data
- MySql Deleting Data
- MySql Display Data
- MySql Edit Data
- Advance
- PHP Date & Time
- PHP Include & Require
- PHP Cookies
- PHP Session
- PHP Mail Function
- PHP Error
- PHP Exception
- File handling
- File
Insert data in mysql table
insert data into database
syntax
INSERT INTO tableName (field1,field2,...) VALUES ('data1','data2',...)
<?php
//the example of inserting data
//data_insert.php
mysql_connect("localhost","root","admin");//database connection
mysql_select_db("employees");
$order = "INSERT INTO employee
(name, address)
VALUES
('xcvbn',
'ramlal')";
//inserting data order
//declare in the order variable
$result = mysql_query($order);
if($result){
echo("<br>Input data is succeed");
}else{
echo("<br>Input data is fail");
}
?>
//the example of inserting data
//data_insert.php
mysql_connect("localhost","root","admin");//database connection
mysql_select_db("employees");
$order = "INSERT INTO employee
(name, address)
VALUES
('xcvbn',
'ramlal')";
//inserting data order
//declare in the order variable
$result = mysql_query($order);
if($result){
echo("<br>Input data is succeed");
}else{
echo("<br>Input data is fail");
}
?>