Home > php教程 > PHP源码 > php php 删除mysql 记录教程

php php 删除mysql 记录教程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:30:05
Original
1160 people have browsed it

我们用php 删除mysql里面的数据代码,这个实例很简单根据用户输入的或提交的信息来查找数据库合条件的信息进行删除

<script>ec(2);</script>

//连接数据库
$link_id = mysql_connect("localhost","root","") or die("连接失败");
if($link_id)
{
 mysql_select_db("my_test");
 if(!$_GET[id])
 {

  $result=mysql_query("select * from userinfo");
  echo "


    
     
     
     
     
     
     
    ";

 

  while($row=mysql_fetch_array($result)){
   echo "


     
     
     
     
     
     
    ";
  }
  echo "
编号 用户名称 性别 年龄 注册时间 操作
".$row[id]." ".$row[username]." ".$row[gender]." ".$row[age]." ".$row[regdate]." 删除
";

 }//显示列表的内容
 else
 {

   $sql="delete from userinfo where id=".$_GET[id];
   $result=mysql_query($sql);
   if($result)
    echo "记录已经成功删除www.111cn.net
返回";
   else
    echo "记录删除失败
返回";

 }//else($id部分)
} // end if
?>
www.111cn.net

Related labels:
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