Database and PHP Concepts

Hey developers! In these tutorials today we want to share the Database concepts by using PHP.

The topic we cover in this tutorials

  1. Introduction to Database
  2. What is Database
  3. Types of Database
  4. How to Create a Database
  5. How to Connect PHP Code with Database

Introduction to Database

A database is a collection of data that is used to store information. The database is the storage of all information electronically. By using a database we can manage our data dynamically. We can add, search, Edit, and delete data on the database.

What is a Database?

As we describe in the introduction a database is the collection of data that is used to store data on a computer or any electronic device. The database is not visible it is logical storage.

System or any Application without a database does not work their function dynamically. A system that does not database is not a system. It is static web pages or HTML, CSS, or JavaScript.

A database is a collection of electronic information that is stored on a computer or server.

Types of Database

There are different types of databases in database concepts. Mainly there are two types of databases in this world of technology.

Those are

  1. SQL Database
  2. NoSql Database

What is an SQL Database

SQL database is a database that relationships with each other. In SQL database we have a database in the database we have tables. SQL Database is a relational database in which tables can communicate with each other by using foreign key columns.

SQL Database is a that has tables.

What is a Table?

Table is a basic element in a relational database. A table is the storage of information in the form of rows and columns. In a relational database, one table can connect with another table that has relationships with each other. Every table has its own name and table ID. Table ID is also called the Primary Key of the table.

The primary Key is the unique identifier of the tables.

Types of SQL databases are

  1. SQL
  2. MySQL
  3. PostgreSQL
  4. SQL lite

NoSql database

NoSql is the name that implies a database that has no relationship with every other. In a nonrelational database, there is no table, instead of a table with the use document in the form of JSON data.

One document contains profile information of data. On document has its own unique identifiers.

In these tutorials, we use Mysql database which is SQL Database

How to Create a Database

In these tutorials, we use the MySQL database on xampp local server. Steps to install xampp on local server and use it you can get on xampp guide and php basic concepts.

To create the database you must check whether your local server is starting or not

After checking your local server start we can create a database in simple ways.

Step 1: Click database

step 2: select the new database and table your database name.

Step 3: choose new tables by selecting your database.

Step4: Create a new table in your database

Create database phptutdb and create table employees that have the following attributes

  1. id
  2. full_name
  3. gender
  4. phone
  5. department
  6. age
  7. salary
  8. dob
  9. Experience

The list of the columns of employees’ tables.

the above shows how to create a table and list columsoftables

To connect this database by using php follow the following steps

Step 1: Create a con.php file

These PHP files can connect your PHP program to the database

Step 2: Copy the following code to your con.php files


$dbconnection=mysqli_connect($server,$user, $password,$db);
echo "Connection Established Successfully!";

echo "Connection Not Established";

The above code makes a connection to your database. PHP is a general server-side programming language.

visit these video tutorials for more information and implementations

Step 3: run your code by writing localhost/phptut/con.php

the above image is the output of the above code!!


A database is the store of any digital information. As we have seen databases have two types relational database and nonrelational database. Both relational database and nonrelational database is used to store data. But they have different syntax and different objects.

To perform any active data operation we must create a database and connect to the database by using php projects.

Thank you for reading and coming back to get more information on how to insert data to the database by using php, updating data, searching data, and deleting data from the database on the next topics.

Remember: Telegram Channel Borufan Tube(

Youtube Channels Borufan Tube (

Author: bbnadmin

Leave a Reply

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