Update Data in MySQL Using PHP

Today, We want to share with you update query in mysql php.In this post we will show you update query in php mysqli, hear for php mysql update multiple fields we will give you demo and example for implement.In this post, we will learn about how to update data in php using form mysqli with an example.

how to fetch and update data from database in php

There are the Following The simple About dynamic update query in php Full Information With Example and source code.

As I will cover this Post with live Working example to develop delete query in php, so the php update sql database from form is used for this example is following below.

To update a data that already exist in the database, UPDATE statement is used.

In the below example we update the worker data from MySQL database.

we used 2 file for update data

  • dbConfig.php– To connecting database.
  • update.php– TO retrieve data from database with a update option.
  • update-process.php– TO update data from database.

Step 1: connecting database

dbConfig.php
To connecting database.


Step 2: retrieve data from database

TO retrieve / fetch data from mysql database with a update option.
update.php






Delete worker data


worker Id Profile Name Real Name Address Email id Action
">Update

Step 3: update data MySql from database in PHP

update-process.php
TO update data from database.

0) {
mysqli_query($conn,"UPDATE worker set memberid='" . $_POST['memberid'] . "', profile_nm='" . $_POST['profile_nm'] . "', real_nm='" . $_POST['real_nm'] . "', full_address='" . $_POST['full_address'] . "' ,email='" . $_POST['email'] . "' WHERE memberid='" . $_POST['memberid'] . "'");
$message = "Record Modified Successfully";
}
$result = mysqli_query($conn,"SELECT * FROM worker WHERE memberid='" . $_GET['memberid'] . "'");
$data= mysqli_fetch_array($result);
?>


Update worker Data


membername:

First Name:

Last Name :

City:

Email:

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about update query in php form.
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