how to update data in mysql database using php

how to update data in mysql database using php

how to update single or multiple records in mysql table using php.
The SQL commands UPDATE is used to modify the data that is already in the database.
The SQL UPDATE command uses a WHERE clause.

SQL UPDATE statement is used to change the data of the records held by tables.
Which rows is to be update, it is decided by a condition. To specify condition, we use WHERE clause or query using php.

example of single column update in sql table-

<?php    
     mysql_query("UPDATE students SET User_Name ='aapkadeveloper' WHERE Student_Id = '3'");
?>

example of multiple column update in sql table-

<?php
mysql_query("UPDATE students SET User_Name ='aapkadeveloper', rollno='10', class='10th' WHERE Student_Id = '3'");
?>
About Author

My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.