PHP? ??? ?? ?? ???? ?? ?? ??
?? ?? ???? ?? ???????. ??? ?? ?? ID? ???? ???? ????. ??? ??? ????.
<a href="modifynew.php?id=<?php echo $row[' id'] ;?>">??</a>
<a href="delnew.php?id=<?php echo $row['id'];?>">??< /a>
????? ??? ???? delnew.php ???? ?????
??: ????? ID? ??? ?? ?? ?? ??????? ???? ?? ?? ???? ???. ??? ??? ?? ??? ? ? ????. ?? ??? ???:
?? ??????? ??
??("Content-type: text/html; charset=utf-8") ;//??? ??
$con =@ mysql_connect("localhost","root","root") or die("?????? ?? ??"); mysql_select_db('news') or die("??? ??????? ??? ? ????. open");
mysql_query("set names utf8 ");//??????? ?? ??? ??
? ?? id? ?????
$id = $_GET['id'];
????? ??? ?????. ???
?????? $sql = "id='$id '"? ? ???? ??;
$res = mysql_query($sql); if($res){
echo "<script>alert('?? ??') ;location.href='newlist.php';</script> ";}} Else {
echo" & lt; script & gt; local .href = 'newList.php'; & lt;/script & gt; ";
??? ??? ??? ????
<?php header("Content-type: text/html; charset=utf-8");//設(shè)置編碼 $con =@mysql_connect("localhost","root","root") or die("數(shù)據(jù)庫連接失敗"); mysql_select_db('news') or die("指定的數(shù)據(jù)庫不能打開"); mysql_query("set names utf8");//設(shè)置數(shù)據(jù)庫的字符集 $id = $_GET['id']; $sql = "delete from new where id='$id'"; $res = mysql_query($sql); if($res){ echo "<script>alert('刪除成功');location.href='newlist.php';</script>"; }else{ echo "<script>alert('刪除失敗');location.href='newlist.php';</script>"; } ?>