MySQL Update Data

by Yogesh Khanna 14-Jun-16

35 0 454

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";

?


Share:

Comments

Leave a Reply