Knowledge about PHP MySQL Delete statement

jacklove
Release: 2023-03-25 14:24:01
Original
1375 people have browsed it

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:

Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!