Create Database with MySql and INSERT coding in php | 2my4edge

18 May 2013

Create Database with MySql and INSERT coding in php

It is basics of PHP, here we are going to see about How to create database and how insert the field values in the database table. for that just follow the below instruction what i given below. as per this just follow to create database and insert in it,
insert db mysql

Database Creation:

Here I’m using WAMP sever, so just go to the localhost as url, and choose phpmyadmin and click on the Database, and fill the name of your database, and click Create.

localhost database  create structure image

And the database will be created as the name what we given,

database  create structure image

After the database created, we have to create a table. Name of the table and number of columns we want, and click Go.

database structure image

database structure image

The above field will be comes like, how many columns we want. fill all the fields without fail.

database image

We have to fill the fields, and click save to finish the table creation

database image

And the database and table creation work is over.

Sample form image

insert sample field

Here we are going to insert values so here we need db.php file mainly,

refer all the above for the database name, database table name, and column name and types. now just follow the coding.


$conn=mysql_connect("localhost","root","")or die('Database not connected');
$db=mysql_select_db("downdrop")or die('Database not connected');

And the insert coding comes on the main page


 $insert=mysql_query("insert into ddtable(name,number,address)

All finished, click on the submit button the result will be comes like,
INSERT sucess


  1. you are great, continue to rock

  2. Thanks a lot, Nice Tutorial

  3. wow ! very nice ,thank you

  4. Thanking you for this valuable tutorial.Very nice snippet.Keep sharing.

  5. This article is right for my husband to read, he is a programmer and he needs it for his job project. Look in here write dissertation Thanks a lot!


  6. I appreciate it!. I really like it when people get together and share ideas. Great website, continue the good work!. Either way, great web and I look forward to seeing it grow over time. Thank you so much.
    super smash flash 2

  7. Every change you make that deviates from the original will construe the intention of the message.