PHPEveryday.com PHP and Web Development Tutorial
What are you looking for?


Table of Content
PHP Mysql Tutorial

MySQL Connect
MySQL Database
MySQL Table
MySQL Field Type
MySQL Char & Varchar
MySQL Date
MySQL Orders
MySQL Inserting
MySQL Form
MySQL Display
MySQL Fetch Row
MySQL Fetch Array
MySQL Edit
MySQL Delete
MySQL Add Field
MySQL Edit Field
MySQL Delete Field

PHP MySQL: Inserting Data


php mysql basic step by step tutorial - part 8: To insert data into database, use the sintaks:
INSERT INTO nama_table (field1,field2,...) VALUES ('data1','data2',...)

If the field parameter do not declare, the amount of the inserting data must have the same as the amount of the table field.
Example:

<?
//the example of inserting data
//data_insert.php
mysql_connect("localhost","root","admin");//database connection
mysql_select_db("employees");
$order = "INSERT INTO data_employees
			(name, address)
			VALUES
			('H.R. Dian',
			'Jl. Raya Baru KOTABARU')";
//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");
}
?>

For the result:

php mysql insert data

If you see through phpmyadmin

php mysql insert data phpmyadmin


Series this article:
PHP MySQL: Connecting to Database Use mysql_connect()
PHP MySQL: Making Database Use mysql_create_db()
PHP MySQL: Making Table
PHP MySQL: The Data Type of Field
PHP MySQL: Char and Varchar Data Type
PHP MySQL: Data Type of Date
PHP MySQL: MySQL Syntax Orders
PHP MySQL: Inserting Data
PHP MySQL: Creating Form Insert Data
PHP MySQL: Display Data
PHP MySQL: mysql_fetch_row() Function
PHP MySQL: mysql_fetch_array() Function
PHP MySQL: Editing data
PHP MySQL: Deleting data
PHP MySQL: Adding Field Table
PHP MySQL: Editing Field Table
PHP MySQL: Deleting Field Table


Tag: mysql, database, insert, data Category: PHP Database Post : March 02nd 2008 Read: 5,603 Bookmark and Share

blog comments powered by Disqus


Database Tutorial
  • Learn PHP MySQL
  • Learn PHP ADOdb
  • Learn PHP Data Object/PDO
  • Learn PHP XML
  • Learn PHP SimpleXML
Security Tutorial
  • Learn PHP Security
  • Learn HTTP Authentication
  • Learn PHPSecureSite
Framework Tutorial
  • Learn CodeIgniter
  • Learn Joomla
  • Learn Smarty
  • Learn Zend Framework
Template Tutorial
  • Learn Joomla Template
  • Learn WordPress Template
API Tutorial
  • Learn Facebook
JS Framework Tutorial
  • Learn MooTools
  • Learn JQuery
AJAX Tutorial
  • Learn AJAX in 10 Minutes
  • Learn AJAX Client Side
  • Learn AJAX PHP
  • Learn AJAX Remote Server
  • Learn AJAX Repetitive
  • Learn AJAX MySQL
  • Learn AJAX Grid
Web Services Tutorial
  • Learn Web Services NuSOAP
  • Learn Web Services WSDL
  • Learn Web Services WSDL Array
  • Learn Web Services .NET Grid
  • Learn Web Services WDDX
Package Post
  • Joomla Intro
  • Joomla Component
  • Joomla Module
  • Joomla MVC
  • Joomla MVC Backend
  • PostNuke Intro
  • Zend Framework Intro
  • Zend Framework Action
  • Zend Framework Database
  • Zend Framework Registry
  • Zend Framework Config
  • Zend Framework Login
  • Zend Framework Session
  • PHP Array Tips
  • PHP File Tips
  • PHP Email
  • PHP Ms Excel
  • PHP Pattern
  • PHP SMS
  • Flash Database
  • PHP Multitier
  • jQuery Introduction
  • jQuery Selectors
  • Portable Web Server
  • Web Mobile Intro
  • Drupal Installation
  • Drupal Configuration