PHP CRUD create, edit, update and delete posts with MySQL database
Published in
1 min readApr 14, 2019
Step: 1 — Creating a sample Database table
In this tutorial, we will work on a simple Database table as below.
CREATE TABLE `student` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,`name` VARCHAR( 100 ) NOT NULL ,`phone` VARCHAR( 100 ) NOT NULL ,`roll` INTEGER( 100 ) NOT NULL) ENGINE = INNODB;
Step: 2— Connecting to Database
Create a PHP file “mysqldrive.php
”; this file contains the code for Database handles all the stuff related to database connections, such as connecting and disconnecting with crud.
To use this class, you will need to supply correct values for
- $host: Database host, this is normally “localhost”.
- $user: Database username.
- $password: Database user’s password.
- $name: Database name which you use to store ‘customers’ table.
You have to main the serialization.
Step: 3— Create html file for crud
Step: 4— Create process file for crud
Conclusion
This brings us to the end of this tutorial. I hope it was helpful and worth your time