How to delete data in data table in php

王林
Release: 2023-03-03 13:36:01
Original
4542 people have browsed it

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].

How to delete data in data table in php

#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
Copy after login

Persons table:

How to delete data in data table in php

(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=&#39;Griffin&#39;");
mysqli_close($con);
?>
Copy after login

Deleted table:

How to delete data in data table in php

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!

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
Popular Tutorials
More>
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!