PHP

How to insert, edit, delete and view using PHP and Mysql?

Insert, View, Edit, Delete Record in Database Using PHP is a very simple task given to php newbie to check about their knowledge in php. This add, list, edit and delete record operation uses all basic SQL queries (i.e., insert, select, update, delete)

Insert record – Insert sql query
View record – Select sql query
Edit record – update sql query
Delete record – delete sql query

There are four php files are used here to do this operations.

config.php
add.php
list.php
edit.php
delete.php

Database

——————————————————————————————————————————–

DATABASE NAME :  17_demo

TABLE NAME:  addd

FIELDS:  id(primary key with auto increment), name, age

——————————————————————————————————————————–Stylesheet

PHP Code to Add Edit List Delete Record

Here is the simple php code for add, list, edit and delete record

config.php



insert.php

  view.php

In list record page, for each records there is a edit and delete option. Edit option invokes edit.php page and delete option invokes delete.php

list-record-database-using-php

 

edit.php

When edit option in list page is clicked, we will be redirected to edit.php and by using  id value (primary key) values will be fetched from database.

 

delete.php

When delete (‘X’) option is clicked in list page, particular record will be deleted by using id values and redirected to list.php

 

Thanks!. IF you like this article please don’t forget to comment and share.