Add Edit Update Delete Using Php and Mysql

Hi Guys, Every web programming language have database operations.

A very basic database operations are add,edit ,update and delete database records. In this tutorial I have to teach how to add ,edit,delete,update a record using php and mysql.

phpcrud

I have to add basic student details in database.I create and use four files to perform this basic database operations.

  1. Config.php
  2. Index.php
  3. edit-studentdetail.php
  4. Manage-students.php

Config.php

contains database connection Details.see the below code.

Index.php

index.php perform  add student details in database .below code explain this operations.

Edit-studentdetails.php 

In this file perform edit and delete student record .see the below code

Next Manage-students.php

Manage-students.php  perform  show all students details fetch from database with edit and delete link. Edit link perform edit student record and update record operations, delete link perform delete a particular record in  database.In the below code explain this operations

I hope in this tutorial give a basic idea about database operations using php and mysql. If you any doubt please leave a comment.

facebooktwittergoogle_plusredditby feather
  • poonam

    I’m totally new in php
    and i just want to know that how this is actually work
    (
    if(isset($_POST[‘uid’]))

    )
    can you please tell how this statement is actaully work.

    and why should we

    $query=”UPdate student_detail SET name=’$name’,gender=’$gender’,department=’$department’,terms=’$terms'”;
    $result=mysql_query($query);

    again pass the values to $result variable if we already pass it in the $query variable?

    I know this very simple things but until i don’t know why I’m writing that things I’ll never become a master in php pls help me

  • Anmol Kumar

    thanks for great help..

    1 small issue is that when i update 1 row of data , all other data gets set to same data..