php剔除记录

WBOY
WBOYOriginal
2016-06-13 10:28:591026browse

php删除记录


 


 
 
  的记录
 


 


 
 


 


=============================================

我想删除指定ID号的记录,数据记录主键为“id”,后面的代码怎么写,我写的代码老是删不掉,麻烦大虾们帮个忙。

------解决方案--------------------
PHP code
<?php #test.phpif(isset($_POST['id2'])){    $sql="delete from table where id=".trim($_POST['id2']);    $res = mysql_query($sql);    if(!$res)        die("SQL:{$sql}<br>Error:".mysql_error());    if(mysql_affected_rows() > 0){        echo "删除成功!<br>";    }else{        echo "查询失败<br>Error:".mysql_error();    }}?>

的记录

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