Home>Article>Backend Development> Knowledge about PHP MySQL Delete statement

Knowledge about PHP MySQL Delete statement

jacklove
jacklove Original
2018-05-07 14:34:24 1378browse

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:


##FirstName

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

LastName

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 recommendations:

Related content about PHP MySQL Update statement


Related content about PHP MySQL Order By keyword Knowledge


Master PHP MySQL Where clause

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!

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