Labels

Cari Blog Ini

Jumat, 30 Juli 2010

Connection MySQL With PHP

To connection database on MySQL in this articel we using 3 method :
1.Create Data base
2.Create Table
3.Insert Record
4.Make File test_mysql.php
5.Running on web browser

Step-1.Create Database

Paste this coding into Window SQL in PHPMyAdmin window.
Create database test;

Step-2.Create table into database test.

Paste this Code into Sql Windows

CREATE TABLE `test`.`table_tes` (
`id` INT NOT NULL AUTO_INCREMENT ,
`first_name` VARCHAR( 25 ) NOT NULL ,
`last_name` VARCHAR( 25 ) NOT NULL ,
`email` VARCHAR( 25 ) NOT NULL ,
`city` VARCHAR( 25 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM

Step-3.Insert record into table table_tes

Paste this code into SQL window make sure database test is choise.

INSERT INTO `test`.`table_tes` (`id` ,`first_name` ,`last_name` ,`email` ,`city`)
VALUES (NULL , 'Adam', 'Moh', 'adam@aol.com', 'Lhokseumawe');

Step-4.Make File test_mysql.php

Make File and save with name test_mysql.php save on htdocs
Paste this code into file test.php and running on the web browser with address name http://localhost/tes_mysql.php
View in Dreamweaver