This project demonstrates how PHP connects to a MySQL database and performs basic CRUD (Create, Read, Update, Delete) operations.
It serves as a learning reference for beginners who want to understand how PHP and MySQL work together to store, display, and manage data.
This website showcases:
- How MySQL is connected through PHP
- How to fetch, insert, update, and delete records
- Basic frontend integration using HTML tables
- A working user management system (view, add, edit, delete)
The goal of this project is to provide a simple and functional example of connecting PHP to MySQL and performing database operations efficiently.
Before you start, make sure you have:
- XAMPP or WAMP installed
- A working PHP environment (PHP 7+ recommended)
- phpMyAdmin access
- A browser (Chrome, Edge, etc.)
Download or copy this project folder into your local server directory:
| Server | Folder Location |
|---|---|
| XAMPP | C:\xampp\htdocs\your_project_name |
| WAMP | C:\wamp64\www\your_project_name |
- Open phpMyAdmin by visiting
http://localhost/phpmyadmin - Click Import
- Choose the exported file (the file is included in this clone 'testdb.sql')
- Click Go
The import process will automatically:
- Create the database
- Add all tables and records
No need to manually create a database name.
Make sure your db.php file is set as follows:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "your_database_name"; // match the name from your exported .sql file
$conn = new mysqli($servername, $username, $password, $database);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>Username: admin Password: test123