Posted inphp / Mysql / Mysqli

How to update query in PHP MySQL?

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

Update Data in MySQL Using PHP

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

In the below easy to best example we update the players data from MySQL database.

we used 2 file for update data

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



Delete players data

Players Id Player Name Player Ranking Player City Player Email id Action


0) {
mysqli_query($conn,"UPDATE players set playerid='" . $_POST['playerid'] . "', playername='" . $_POST['playername'] . "', player_ranking='" . $_POST['player_ranking'] . "', player_city='" . $_POST['player_city'] . "' ,email='" . $_POST['email'] . "' WHERE playerid='" . $_POST['playerid'] . "'");
$message = "Record Modified Successfully";
$result = mysqli_query($conn,"SELECT * FROM players WHERE playerid='" . $_GET['playerid'] . "'");
$row= mysqli_fetch_array($result);

Update Players Data


First Name:

Last Name :



I hope you get an idea about dynamic update query in php.
I would like to have feedback on my 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.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype