Delete< /a>'] statement is enough."/> Delete< /a>'] statement is enough.">

Home >Backend Development >PHP Problem >How to delete a piece of data in php

How to delete a piece of data in php

王林
王林Original
2020-10-21 14:26:143828browse

How to delete a piece of data in php: execute [echo '9b07c10f3ce54d9a21cba5ddfd1f0a71Delete the '] statement.

How to delete a piece of data in php

Specific method:

(Recommended tutorial: php video tutorial )

echo &#39;<a href="www.phpfensi.com/11.php?id=你要删除记录" confirm("是否真的要删除当前记录?")">删除</a>&#39;.

Of course you can also use the following method to delete instances. The code is as follows:

<script language=&#39;javascript&#39;> 
function del(id){ 
    if (false === confirm(&#39;是否真的要删除当前记录?&#39;) )return; 
    location.href = &#39;delete.php?id=&#39; + id; 
} 
</script>

Here you only need to modify your database connection username and password, the database name and the data table name. That’s it.

<?php 
    $conn = mysql_connect("localhost","root","8588027"); 
    mysql_select_db("test"); 
    $exec="delete from content where id=&#39;{$_get[&#39;id&#39;]}&#39;"; 
    mysql_query($exec); 
    mysql_close(); 
    echo "<script language=&#39;javascript&#39;>location.href=&#39;code.php&#39;;</script>"; 
?>

Related recommendations:php training

The above is the detailed content of How to delete a piece of data in php. 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