How to set up and use xampp for php projects (Part – III)

How to set up and use xampp for php projects (Part – III)

Hi friend this is third part of tutorial on How to set up and use xampp for php projects. Previously you learnt about Download/Installation of XAMPP Server and Running a php script on XAMPP Server.Now in this tutorial  i will tell you how to run sql database queries. XAMPP server comes with MySQL for running SQL queries. In order to use this service you need to start MySQL module from XAMPP control panel.

Start MySQL Module

 

Now in order to access database go to http://127.0.0.1/phpmyadmin/ or http://localhost/phpmyadmin  and you will get easy to use phpMyAdmin interface to handle database queries :

PHPMyAdmin

Here you can create new Database using New option from left sidebar or from Databases button on top menu bar. For Example: To create database named project, enter “project” in Database Name field and click on create button to create database. Now project database name will be populated in left sidebar click on it in order to run any SQL query inside it. You will get create table interface, from where you can create tables in your database.

create a new table test with 2 columns and click on go option to create table. Now add columns in table as given below:

Create Table

and click on save Button. This will create a table test with two columns id and name with id as primary key with integer data type and name with Varchar data type.

Now in order to insert values in table you can go to Insert option from top menu bar and add values to it. If you know sql queries very well then you can do all of the above task by running SQL queries. In order to run SQL queries click on SQL option from top menu bar and enter your sql queries and click on Go to run it. Here are few important sql queries example:

Creating table test by sql queries:

CREATE TABLE test (
id int(11) not null,
name varchar(20) not null,
PRIMARY KEY(`id`)
)

Above query will create Table named test with 2 columns id and name. This tutorial was about running MySQL queries using phpMyAdmin. In next tutorial you will learn about running Mysql queries using php code. If you have any query related to this article do let me know by your comment.

Next Part :  Running Mysql query using Php script

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.