To-Do List Application Using PHP, MySQL and AJAX

To-Do lists are a great way to keep track of your daily tasks. In this tutorial, we will build our own to-do list using PHP, MySQL, and AJAX. This tutorial assumes that you have a basic understanding of HTML, PHP, MySQL, and jQuery. We will cover this tutorial in easy steps with a live demo of the To-Do List Application Using PHP & MySQL.
So let’s implement To-Do List Application Using PHP & MySQL. Look following folder and file structure:
  • to-do-list-application-using-php-and-mysql
    • assets
      • css
        • style.css
      • js
        • todo.js
    • templates
      • header.php
      • footer.php
    • class
      • DBConnection.php
      • ToDoList.php
    • index.php
    • action.php
Step 1: Create MySQL Database Table
First, we will create database with the following table.
Step 3: Database Connection class
Create a class file named DBConnection.php inside “class/” folder.
Step 4: Create a class file named ToDoList.php inside “class/” folder.
Manage CRUD Operations
  • CREATE – INSERT record in database.
  • READ – read records from database.
  • UPDATE – Executes an UPDATE record in database
  • DELETE – delete specified records from databse.
Step 5: Create action file named action.php
Manage request and return as JSON data
Step 6: Create action file named index.php
We need to do is lay-out the structure for our main index page index.php
Create header.php and footer.php section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
header.php
footer.php