Introduction

This project demonstrates how to perform basic CRUD (Create, Read, Update, Delete) operations in PHP using a MySQL database. It also includes functionality to upload and store user images. The application allows users to register, view records, edit existing records, and delete records through a simple web interface.

Prerequisites

Before implementing the project, ensure the following requirements are met:

  • PHP installed (XAMPP, WAMP, or LAMP)
  • MySQL database server
  • Apache Web Server
  • Web browser
  • Basic knowledge of PHP, HTML, and MySQL
  • Create the demo database and reg table
  • Create an upload folder with write permissions for storing uploaded images

Implementation

The project consists of the following modules:

1. Database Creation

  • Create the demo database.
  • Create the reg table with fields such as name, password, address, email, father name, mother name, country, state, city, and photo.

2. Insert Module

  • Accept user details through an HTML form.
  • Upload the selected image to the upload folder.
  • Insert all user information into the MySQL database.

3. View Module

  • Retrieve all records from the reg table.
  • Display the records in an HTML table.
  • Provide Edit and Delete options for each record.

4. Update Module

  • Fetch the selected user’s details.
  • Display the data in an editable form.
  • Update the modified information in the database.

5. Delete Module

  • Delete the selected user record from the database using its ID.
  • Refresh the record list after deletion.

Conclusion

This project successfully demonstrates the implementation of basic database operations using PHP and MySQL. It covers inserting, viewing, updating, and deleting records along with image upload functionality. It provides a foundation for developing PHP-based web applications that interact with MySQL databases. Although the code uses older MySQL functions (mysql_*), it can be enhanced by using MySQLi or PDO with prepared statements for improved security and compatibility with modern PHP versions.

Leave a Reply