Simple Crud operations in php using mysql Example

Today, We want to share with you crud operation in php.In this post we will show you creating a complete PHP PDO CRUD Create, edit, update and delete posts with MySQL database, hear for how to make the beginnings of a very simple database app, using PHP and MySQL. we will give you demo and example for implement.In this post, we will learn about Select Insert Update Delete in PHP MySQLi with an example.

PHP MySQL CRUD Application

PHP and MySqli CRUD Operation Tutorial
PHP and MySqli CRUD Operation Tutorial

What is CRUD?

CRUD stands for Create, Read, Update, Delete operations with database table records. Most online web applications as well as Company projects perform some kind of CRUD functionality, you need to multiple time the CRUD Operations for every object in your system.

Files includes in this tutorials

  • members_app.sql: Contain the database table structure.
  • config_database.php: Used for database connection.
  • index.php: Used to Get the member from database.
  • list.php: Used to Get the member of particular member.
  • edit.php: Used to edit the member.
  • member_store.php: Used to insert the new member.
PHP - MySQLi Insert Update Delete CRUD Operation using AngularJS
PHP – MySQLi Insert Update Delete CRUD Operation using AngularJS

Step 1– Create a database

We’ll create a database with a “members_table” table, we’ll be able to manipulate these members_table in our CRUD app, the “members_table” table will contain names, emails, Mobile numbers, etc.

CREATE TABLE `members_table` (
  `ID` int(10) NOT NULL,
  `member_name` varchar(200) DEFAULT NULL,
  `member_fullname` varchar(200) DEFAULT NULL,
  `conatct_no` bigint(10) DEFAULT NULL,
  `Email` varchar(200) DEFAULT NULL,
  `mem_location` mediumtext DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Step 2– Create a database connection

config_database.php


Step 3– Create a HTML form for data insertion

Fill Data

Fill below form.

Step 4– data insertion

member_store.php

alert('You have successfully inserted the data');";
    echo "";
  }
  else
    {
      echo "";
    }
}
?>

Step 5– List / Fetch the record from the database

index.php

0){
while ($row=mysqli_fetch_array($ret)) {

?>
# Name Email Mobile Number Created Date Action
No Record Found

Step 6 – List / Fetch the particular record

list.php

Member Name Last Name
Email Address Mobile Number
Location Creation Date

Step 7 –Edit/ Update the particular record

edit.php

Update

Update your info.

Step 7.1 Update the Member record.

edit.php

alert('You have successfully update the Member');";
    echo "";
  }
  else
    {
      echo "";
    }
}
?>

Step 8 – Member deletion from the database

alert('Data deleted');"; 
	echo "";     
} 
?>

I hope you get an idea about how to create CRUD operation using PHP and MySQLi..
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment