MySQL is a freely available open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL).SQL is the most popular language for adding, accessing and managing content in a database. It is most noted for its quick processing, proven reliability, ease and flexibility of use. MySQL is an essential part of almost every open source PHP application.
Software Requirements for the Tutorial.
To set up the PHP development environment, we mainly need two software, a code editor and a web server package.
We will be using :
How to Create a Database?
A database is defined as an organized collection of data that makes the data easy to access, manage and modify. Generally, databases use SQL (Structured Query Language) for data manipulation.
To create a database:
- Open XAMPP Control Panel and start the Apache server and MySQL service.
- Now, go to your browser and type localhost in the address bar, and then on the XAMPP dashboard, click on the phpmyadmin tab.
- Into the phpmyadmin section, click on new to create a new database. Here, name your database “my_database”.
- Now, create a table named “users” that you can use to register users:
Keep the “id” column as Auto Incremented by clicking the check box next to ‘AI’ since it will be the primary key.
How to Connect Webpage to the Database Using PHP?
To connect the webpage to the database, create another file in the code editor named “config.php” and write the following code:
$servername = “localhost”;
$username = “root”;
$password = “”;
$dbname = “my_database”;
$conn = new mysqli($servername, $username, $password, $dbname);
die(“Connection Failed” . $conn->connect_error);
In this, you have learned how to create a database using XAMPP and MySQL. In the later sections, you learned how to connect the webpage to the database and then finally how to edit and delete the entries in the table using the phpmyadmin panel.
You can refer here for a video tutorial on the same.