$id=$_GET['id']; $id 是一個(gè)變量吧! 變量獲得什么值,就對(duì)應(yīng)刪除那條數(shù)據(jù)。和數(shù)據(jù)庫(kù)的ID自增沒(méi)關(guān)系的。

明水網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、APP開(kāi)發(fā)、響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開(kāi)發(fā),運(yùn)營(yíng)維護(hù)。創(chuàng)新互聯(lián)建站成立與2013年到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
?php
if(isset($_GET['id'])!empty($_GET['id'])){
$id=intval($_GET['id']);
$sql="delete from jxkc_a1 where id = $id";
if(mysql_query($sql)){
echo "script type='text/javascript'alert('操作成功')/script";
}else{
echo "script type='text/javascript'alert('操作失敗')/script";
}
}
?
?php
$arr = mysql_query("select * from jxkc_a1 where username='$username' order by id desc" );
while($result = mysql_fetch_array($arr))
{?
tr
tdspan class="STYLE9" ?php echo $result["lesson"];? /td
tdspan class="STYLE9" ?php echo $result["plantime"];? /td
tdspan class="STYLE9" ?php echo $result["student"];? /td
tdspan class="STYLE9" ?php echo $result["classtime"];? /td
tdspan class="STYLE9" ?php echo $result["type"];? /td
tda href=(這里假設(shè)你的地址是./list.php)"./list.php?id=?php echo $result["id"] ?" onclick=".......js"刪除/a/td
/tr?php } ?
//例子
var?id=$(selecter).val();
//取出要?jiǎng)h除數(shù)據(jù)的id
$.post('del.php',{id:id},function(data){//提交到刪除頁(yè)面
alert('操作結(jié)果:?當(dāng)前'+data.id+data.msg);//data就是頁(yè)面返回的信息
},'json')//返回的數(shù)據(jù)是json
?php
//刪除頁(yè);
if(isset($_POST['id'])){
//執(zhí)行mysql刪除;
$sql=""http://刪除語(yǔ)句;
if(mysql_query($sql)){
$data=array(
'id'=$_POST['id'],
'msg'='刪除成功'
);
}else{
$data=array(
'id'=$_POST['id'],
'msg'='刪除失敗'
);
}
//返回的json數(shù)據(jù)
exit?(json_encode($data));
}
名稱欄目:php刪除數(shù)據(jù)id值 php實(shí)現(xiàn)刪除功能
網(wǎng)頁(yè)路徑:http://www.chinadenli.net/article36/dddhdpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)站策劃、面包屑導(dǎo)航、網(wǎng)站內(nèi)鏈、全網(wǎng)營(yíng)銷推廣、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容