MySql Update Data

MySQL Update Data

If you want to modify the existing data in the table then,”UPDATE” statement is used for this.

Syntax :

<?php

$sql=”UPDATE table_name SET field1=’value’,field2=’value2′ WHERE id=1“;

$result= mysql_query($sql);

echo “Data Updated Successfully”;

?>

Example:

<?php

$sql=”UPDATE students SET division=’First’ WHERE ROLL_NO=20″;

// students is table name and division is field name

$result= mysql_query($sql);

echo “Data Updated Successfully”;

?>

onTime It Solution

onTime IT Solution always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

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