PHP SQL Update
PHP SQL Update is used to execute the mysql _update () function that modify the table structure and set the new value for the existing value on the condition specified in Where Clause.
Understand with Example
This example illustrates an example from 'PHP SQL Update'. To understand and grasp the example we create a update query "UPDATE emp_table SET emp_name = 'amar' WHERE emp_name = 'sandeep' AND emp_designation = 'programmer'". The update table is used to modify any field value of any MySQL table in PHP.
Syntax: The SQL syntax of UPDATE command is used to perform update data into MySQL table:
UPDATE table_name SET field1=new-value1, field2=new-value2[WHERE Clause] |
-
The UPDATE query is used to modify one or more field all together.
-
The WHERE clause is used to specify any condition.
-
You can update values in a single table at a time.
The WHERE clause is very useful when you want to update selected rows in a table.
Table: emp_table
Table: emp_table
Source Code of sql_update.php
<?php
|
Output: