How to Connect Database on Plesk Control Panel
In this blog, you will learn how to start managing database using PHP and also you will learn how to use PHP to insert into Mysql database. Before we proceed to connect PHP to a database you should gain access to your hosting control panel we are using Plesk Control Panel for this purpose.
1. Create a Mysql database on Plesk Control Panel:-
You have to create a database on Mysql database section. After creating a database on Plesk Control Panel it will look like given below.
2. Create a table:-
Visit phpMyAdmin for creating a table. We will create a table named employee for our database. You can also create a new table by clicking create table button. After entering all the details your table looks like given below.
3. Writing PHP code for connecting to Mysql database:-
There are two types to connect an SQL database with PHP that are MySQLi and PDO. We will go throw MySQLi where this is stands for MySQL Improved. This MySQLi introduce a new feature to the MySQL interface especially.
So here is basic PHP code example which is used to establish a connection to MySQL database using MySQLi.
4. Successfully record inserted:-
Once you created the successful connection to the database you can see recorded value is displayed such as given below.
Leave a Reply