Home >Backend Development >PHP Problem >How to write php modification statement
The PHP modification statement is "update student set field 1='new value 1,...'where id= $id",...;", where the update statement is used to modify the data in the database table.
Recommended: "PHP Video Tutorial"
PHP sql modification statement
Grammar:
$sql = “update student set 字段1='新值1,…'where id= $id”,…;
Note: The modified keyword is update, not update. The conditions after where can be the same as the modified content.
PHP MySQL Update
The UPDATE statement is used to modify data in the database table.
Update data in the database
The UPDATE statement is used to update existing records in the database table.
Syntax
UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value
Note: Please pay attention to the WHERE clause in UPDATE syntax. The WHERE clause specifies which records need to be updated. If you want to omit the WHERE clause, all records will be updated!
In order for PHP to execute the above statement, we must use the mysqli_query() function. This function is used to send queries or commands to the MySQL connection.
The above is the detailed content of How to write php modification statement. For more information, please follow other related articles on the PHP Chinese website!