Get the App
SLTechnology News&Howtos  ›  Development  › 

How php deletes mysql lines

Shulou Source: shulou.com Published: 2022-06-03 19:48:06 09月21日 Update

This article mainly explains "php how to delete mysql lines", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "php how to delete mysql lines" bar!

In PHP, rows can be deleted from the mysql database table through the DELETE statement, and the delete syntax is "DELETE FROM table_name WHERE some_column = some_value".

Operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer

How does php delete mysql lines?

The PHP MySQL Delete:DELETE statement is used to delete rows from a database table.

Delete data from the database

The DELETE FROM statement is used to delete records from the database table.

Grammar

DELETE FROM table_nameWHERE 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!

In order for PHP to execute the above statement, we must use the mysqli_query () function. This function is used to send a query or command to a MySQL connection.

Example

Please look at the "Persons" table below:

The following example deletes the records of all LastName='Griffin' in the "Persons" table:

Tags: Data database statement clause grammar faceted learning content function instance can be passed command that is train of thought situation article more comment version environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi NVidia Shulou Tech Info OPPO Reno Microsoft