CRUD IN PHP

What is crud ?



Crud stands for create , read , update and delete operations in database if you are new to php and want to experience crud operations in php than you are right place if you are a professional developer you have to use these operations in every span of your proagraming language if you are beginner don't worry at all i will explain here all these php things step by step.




Steps for Crud operations in php



  • Create a database as you wish but for demonstration purpose i am using my database name as "php_operations".
  • Enter sql file in your sql tab after creating database and your database with table is ready.



Now we need following files for crud operation


We need a system that can enter records in table so here i am using index.php to insert record in mysql.The logic behind this operation is insert query of mysql.

After insert operation we need another file that can display all the records on your screen for this thing i am using "display.php" file here.This file will read the records from mysql table and display them on the screen.The main logic behind this file is select command of mysql select command will select all ths data in mysql table and php will display all these records on screen we will also provide two more links in this table one for update record i.c we will link update link to update.php that will take id of particular record from display file to update.php to update the record in database.
The second link will be delete link a id will also pass from display.php to delete.php so that it can conclude which record it have to delete.

so i am using update.php for record updation and delete.php for deleting record.For updation the main logic behind it is update query while in delete.php is sql delete query.Kindly notice the delete.php file will delete the record and again pass control to display.php for more details watch the video above  find code for these files as given below :















If you have any quer regarding this tutorial  kindly leave a comment in commentbox