PHP MySQL CRUD Application Project
Here I have shared a simple PHP MySQL CRUD application project. This PHP CRUD app is written in all three methods (PDO, MySQLi OOP and Procedural). You can use any one of them as per your choice. All three have the same database structure.
Download the PHP MySQL CRUD app
- Download from: GitHub
How to Setup this Project in your System
I hope you have local server (localhost) installed in your system. If not, then install XAMPP to setup your localhsot.
- Open your XAMPP Control-panel and start Apache and MySQL server.
-
After that, open your browser and go to your phpMyAdmin , and then create a database called
crud
by clicking on theNew
button which is on the left panel of the phpMyAdmin. -
After creating the database, you can see the
crud
database on the left panel of the phpMyAdmin. Click on the database to select the datbase. -
After selecting the database, you can see
SQL
tab at top and after theStructure
. Click on theSQL
tab. Now you can see a text-area. Copy the following SQL code and paste into thetext-area
and then click on theGo
button.
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
This SQL code creates a new table called users
that has three fields id
, name
and email
. Here the users data will be stored.
- After completing the database setup, go to the localhsot htdocs or www directory and clone the
chandantudu/php-crud-app
repo here or you can extract the downloaded zip file here.
Tip: If you are not able to find the htdocs folder then click on the Explorer
which is on your XAMPP control-panel.
Test the PHP CRUD application
To test this PHP crud applicaiton open one of the follwing urls on your browser.
http://localhost/php-crud-app/mysqli/create.php
http://localhost/php-crud-app/mysqli-oop/create.php
http://localhost/php-crud-app/pdo/create.php