ProjectsCore· 180 min read

Project: PHP CRUD App

Build a complete database-driven app — list, add, edit and delete records — with plain PHP and MySQL.

What you will learn

  • Build full CRUD with PHP + MySQL
  • Handle forms and validation
  • Structure a multi-file app

The brief

Build a small manager app (tasks, contacts, products) where users can list, add, edit and delete records stored in MySQL.

  • A MySQL table for your resource.
  • A page that lists all records from the database.
  • A form to add a record (with validation).
  • Edit and delete for each record.
  • PDO with prepared statements throughout.
  • A shared header/footer via include.

Work through the CRUD steps in this order — each one builds on the last, so the app keeps working at every stage:

  1. Set up the database: create the table (for example tasks with id, title, done) and a config.php that opens a PDO connection (the connect lesson).
  2. Build the shared header/footer: make header.php and footer.php and include them on every page so all pages share one layout.
  3. READ (list): write the listing page that runs SELECT * FROM tasks and loops the rows with foreach to show them in a table.
  4. CREATE (add): build an HTML form that posts to an add script, validate the input, then INSERT with a prepared statement and redirect back to the list.
  5. UPDATE (edit): link each row to an edit page that loads that record by id, shows it pre-filled in a form, and UPDATEs it with a prepared statement on submit.
  6. DELETE: add a delete link per row that passes the id to a delete script which runs a prepared DELETE ... WHERE id = ?, then returns to the list.
  7. Secure everything: confirm every query uses ? placeholders, and wrap any user text you print in htmlspecialchars().

Note: Each numbered step maps to one letter of CRUD plus the plumbing around it: step 1 is the connection, steps 3–6 are Read, Create, Update and Delete, and steps 2 and 7 are the structure and safety that hold it together.

Tip: Build one operation at a time: get listing working, then add, then edit, then delete. A small app that fully works beats a big unfinished one.

✍️ Practice

  1. Build the full CRUD app meeting all six requirements.
  2. Test every operation in the browser.

🏠 Homework

  1. Add a search box that filters the list using a prepared LIKE query.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →