PHP MySQL CRUD Application

In the video series I have shown how you can create a simple CRUD application with PHP as front end and MySQL database as the back end. CRUD Stands for Create Read Update and Delete operations. On studying how to create a simple CRUD project you successfully learned the basic database operations with the application.

The project is divided to Five basic steps mentioned below.
1. Create Database,Table in MySQL and create the config.php to setup connectivity.
2. Create Operation, Insert data from PHP page to MySQL database.
3. Read Operation, Select data From MySQL database and Show on PHP Page.
4. Update Operation, Edit MySql data from PHP Page.
5. Delete operation, Delete a Value from MySQL From PHP page.

1. Create Database,Table in MySQL and create the config.php

As shown in the video, After creating the database inside MySQL, Execute the below query to create the table inside.

Creating the database configuration file db_config.php

The db_config.php file can be added into all pages where ever we need the database connectivity.

2.Create Operation, Insert data from PHP page to MySQL database

The add_student.php page has the form to submit the required name,grade and address field. The form is submitted to the same page and then redirected to index.php which lists all the values from the database. The connectivity to the database is called by adding the code require_once(‘db_config.php’) in the page.

3.Read Operation, Select data From MySQL database and Show on PHP Page.

The index.php has takes all the values from database and display the data in a table format.
It has also edit and delete options which will take the page to corresponding pages with the sl_no of the value as URL parameter.

4. Update Operation, Edit MySql data from PHP Page.

From the index.php the sl_no of the value is passed to edit.php. According to the sl_no corresponding value data is taken from the database and filled in the form. After submitting the form to update.php. The data is updated in database and redirects the page to index.php.

5. Delete operation, Delete a Value from MySQL From PHP page.

Same way like in edit.php. The sl_no of the value is passed to delete.php and then the value is deleted with the delete query.

After running the codes in xampp server in localhost, The pages are shown below.
index.php

add_student.php

edit.php

18 views