Monday, March 14, 2011

Learn Database Connection in PHP in 15mins (15-Steps)

I tried to make this article more simple and interactive for you......


To learn the database connection in PHP, you have to follow some easy steps which are described below.
But make sure that you have installed the "WAMP SERVER" in your PC.


Step 1: Start the WAMP server



(Fig shows the WAMP latest version 2.1 )

Step 2: Click on WAMP server icon from notification bar and select "phpMyAdmin".......



Step 3: It will show like this......




Step 4: Click On "Databases"




Step 5:  Write your database name in textbox under "Create new database" below:
Step 6: Then message "Database db1 has been created" will be displayed.....


Step 7: Give the name of the table and number fields like shown in the figure..................



Step 8: Give name, datatype and primary key to fields...................



Step 9:  Then Click On Save Button.......and it will show a page  like below........




Step 10: Now Click On Insert  Tab for inserting data into table................



Step 11:  Write the values in the value fields and other part remains blank..........



Step 12: Click on Go below of the second data field.........



Step 13: Now your data are inserted into the table



Step 14 (a): Now openNotepad file..................



Step 14 (b): Write the same code which is given below:




Step 14 (c): Save notepad file in WAMP folder: "C:\wamp\www\"


Step 15: Final Step:
Now execute your file in WAMP - Local Host.............