PHP MySQL Delete statement is particularly important in PHP, so this article will explain its related knowledge in detail.
Delete data in the database
The DELETE FROM statement is used todelete recordsfrom the database table.
Syntax
DELETE FROM table_name
WHERE some_column = some_value
Note: Please note the WHERE clause in the DELETE syntax. The WHERE clause specifies which records need to be deleted. If you want to omit the WHERE clause, all records will be deleted!
To learn more about SQL, please visit our SQL tutorial.
In order for PHP to execute the above statement, we must use themysqli_query() function. This function is used to send a query or command to the MySQL connection.
Example
Please look at the "Persons" table below:
LastNameAge
#Peter Griffin 35
Glenn Quagmire 33
The following example deletes all LastName='Griffin' in the "Persons" table Records:
After this deletion, the "Persons" table looks like this:
FirstName
Age##Glenn Quagmire 33
This article explains in detail the usage of the PHP MySQL Delete statement. For more learning materials, please pay attention to php Chinese You can watch it online.
Related content about PHP MySQL Update statement
Related content about PHP MySQL Order By keyword Knowledge
The above is the detailed content of Knowledge about PHP MySQL Delete statement. For more information, please follow other related articles on the PHP Chinese website!