Home > php教程 > php手册 > php删除一条记录(删除确认提示)

php删除一条记录(删除确认提示)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-25 16:46:10
Original
1424 people have browsed it

删除记录是php与数据库常见的基本操作,下面我们主要是介绍php mysql删除数据库中的一条记录方法.代码如下:

echo '删除'.

当然你也可以利用下面方法实例删除,代码如下:

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

这里只要修改你的数据库连接用户名密码,与数据库名称以及数据表名就可以了.

<?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>"; 
?>
Copy after login


文章地址:

转载随意^^请带上本文地址!

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template