The UPDATE statement is used to update records in a table.
There may be a requirement where existing data in a MySQL table need to be modified. You can do so by using SQL UPDATE command. This will modify any field value of any MySQL table.
UPDATE table_name SET field1=new-value1, field2=new-value2
You have to be very careful when updating records this way and double check your syntax, as it is very easy to inadvertently overwrite several records.
Let’s see example how to use update query. In below example update name=Qpt and age=24 in id=1
$select_q = "UPDATE employee SET name='Qpt',age=24 WHERE id=1";
$select_r = mysql_query($select_q);