Home >Backend Development >PHP Problem >How to delete data in data table in php
How to delete data in the data table in php: You can delete it through the mysqli_query() function combined with the DELETE FROM statement. The DELETE FROM statement is used to delete records from a database table. The syntax structure is: [DELETE FROM table WHERE condition].
#DELETE FROM statement is used to delete records from a database table.
(Recommended tutorial: php graphic tutorial)
Syntax:
DELETE FROM table_name WHERE some_column = some_value
Persons table:
(Learning video recommendation: php video tutorial)
Code implementation:
<?php $con=mysqli_connect("localhost","username","password","database");// 检测连接 if (mysqli_connect_errno()){ echo "连接失败: " . mysqli_connect_error(); } mysqli_query($con,"DELETE FROM Persons WHERE LastName='Griffin'"); mysqli_close($con); ?>
Deleted table:
The above is the detailed content of How to delete data in data table in php. For more information, please follow other related articles on the PHP Chinese website!