PHP CRUD Operations using jQuery, Ajax and MySQL

CRUD is an acronym that stands for Create, Read, Update, and Delete. Add, Read, Update and Delete functionality is commonly used in the data management section of a web application. In this tutorial, you will learn how to build a PHP CRUD Operations using jQuery, Ajax, and MySQL without refresh page. You can also download source code of the live example.
So let’s implement PHP CRUD Operations using jQuery, Ajax & MySQL. look files structure:
  • php-crud-operations-using-jquery-ajax-mysql
    • assets
      • css
        • style.css
      • js
        • ajax.js
    • templates
      • header.php
      • footer.php
    • modal
      • add.php
      • view.php
    • index.php
    • action.php
Step 1: Create the database and Table
Run the following script against MySQL to create the database student table.
Step 2: Database Configuration (DbConnection.php)
The DbConnection.php file is used to connect and fetch record from database. You should change your username, password and database name. See the config.php file below.
Step 3: Create a class file named Student.php inside “class/” folder.
Step 4: Create action file named action.php
Manage ajax request and return as JSON data
Step 5: Create index.php
Step 6 : Create and display Student record
add.php
view.php
Step 7: Create JavaScript file
The following JavaScript code handles the CRUD request using jQuery and Ajax
Step 8: Create header (header.php)
This view contains the header section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header section.
Located at the top of a website, the header typically contains elements that include a company’s logo, website navigation, and contact information.
Step 9: Create a view file named footer.php
This view contains the footer section of the webpage.
  • jQuery – needed by Bootstrap JavaScript.
  • Bootstrap JavaScript – to make cool UI