Home >Backend Development >PHP Problem >How to write php modification statement

How to write php modification statement

藏色散人
藏色散人Original
2020-10-13 09:53:112994browse

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.

How to write php modification statement

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn