Saturday, April 30, 2011

How To Create Databse in MySql for PHP

Simple steps for creating the database in MySql for PHP.Just follow the below steps.

1.Start the wamp server and then select the localhost from wamp server pop menu as shown in below figure or just type the http://locahost/ .

2.After selecting localhost or typing http://localhost you'll get the home page of the PHP as shown in figure.

3.Select the phpmyadmin from the Tools and you will get the phpmyadmin home page.

4. Write down the your database name and click on create as shown below.

5.After clicking on the create button you will get the new window in which you will have to enter the Table name and number of columns in the table as shown in figure.Enter the Table Nameand Column Name and click on the GO.

6.After clicking the GO you will get the screen in which you will have to enter the all information of each and every column(column name,data type and size).
Sample is given below.

Field Type Length/Values
Mobile_No DECIMAL 10,0

7.Rules for the field name.
  1. Field name should be start with a-z,A-Z or _.
  2. Field name should not be start with 0-9 or any other special character like @,#,$.
  3. Field name should not be a any reserved words of the mysql like int,varchar,decimal etc...
  4. If the data type of the field are INT,TINYINT,BIGINT,DATE,DATETIME,then there is no need to give a size.Just leave the Length/Values column blank for those field as shown in the example for the ID field.
  5. If the data type of the field is the DECIMAL, then enter the size as shown in example.Digits before point,digits after point.
  6. If you want to define any field as Primary key then select the primary key radio button on the right side.
8. After inserting details of all the field the just click on the Save.

9.After clicking on the Save button your data base is ready to use with PHP page.

I'll explain you how to use database in the PHP page in the next BLOG.

If you like this blog and helpful to you then leave the comment for this blog that will help me to continue with BLOG .Waiting for response.

Also let me know in case of you have any problem in creating the database using these steps.

No comments:

Post a Comment