This is a simple PHP and MySQL CRUD (Create, Read, Update, Delete) application using PDO (PHP Data Objects) for database interaction. It allows users to perform basic operations like adding, editing, deleting, and viewing data from a MySQL database.
- Web server (e.g., Apache)
- PHP (>=7.4.0)
- MySQL database server
- Knowledge of HTML, PHP, and MySQL
- Clone or download the project files to your local machine.
- Import the
database.sql
file into your MySQL database to create the necessary database and tables. - Update the
config.php
file with your database connection details (hostname, database name, username, and password). - Place the project files in your web server's document root directory.
- Ensure that your web server and MySQL server are running.
- Open your web browser and navigate to the project directory.
- You can add new data by clicking on the "Add New Data" link on the homepage (
index.php
). - To edit existing data, click on the "Edit" link next to the respective entry on the homepage.
- To delete data, click on the "Delete" link next to the respective entry on the homepage (a confirmation dialog will appear).
- The homepage (
index.php
) displays a table with all existing data, including options to edit or delete each entry.
add.html
: HTML form to add new data.add.php
: PHP script to handle the addition of new data to the database.config.php
: PHP script containing database connection settings.database.sql
: SQL script to create the necessary database and tables.delete.php
: PHP script to handle the deletion of data from the database.edit.php
: PHP script to handle the editing of existing data.index.php
: Homepage displaying existing data and options to add, edit, or delete entries.
- This application uses PDO for database interaction, which provides a secure and efficient way to access databases in PHP.
- Ensure that you have proper error handling and security measures in place before deploying this application in a production environment.