php點(diǎn)擊刪除數(shù)據(jù) php點(diǎn)擊刪除數(shù)據(jù)沒反應(yīng)

php 緊急求助,想實(shí)現(xiàn)點(diǎn)擊刪除按鈕刪除數(shù)據(jù)庫內(nèi)對(duì)應(yīng)的id信息

?php

成都創(chuàng)新互聯(lián)公司是一家專業(yè)提供綏中企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站建設(shè)、網(wǎng)站制作、成都h5網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為綏中眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。

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 } ?

php 刪除數(shù)據(jù)庫按鈕功能

列清單的代碼不正確,沒有把編號(hào)作為參數(shù)傳遞給刪除的PHP程序,修改如下:

?php

while(list($id,$content,$date)=$stmt-fetch(PDO::FETCH_NUM))

{

echo?"tr

td$id/td

td$content/td

td$date/td

tda?href='ed.php?id=$id'編輯/a

a?href='del.php?id=$id'刪除/a/td

/tr";

}

刪除的文件有的小的修改,把判斷if(isset($_get['sc']))取消,只需要判斷參數(shù)id既可,這樣:

$id=$_GET['id'];

if($id!=''){

....執(zhí)行delete....

}

php怎么刪除數(shù)據(jù)的

為刪除按鈕增加一個(gè)sub句柄name=del,$_POST['sub']按鈕觸發(fā)sql處理刪除數(shù)據(jù)庫中的數(shù)據(jù),

我只能提供思想,實(shí)際問題實(shí)際對(duì)待。不懂的可以繼續(xù)問我。

標(biāo)題名稱:php點(diǎn)擊刪除數(shù)據(jù) php點(diǎn)擊刪除數(shù)據(jù)沒反應(yīng)
當(dāng)前地址:http://bm7419.com/article18/dohphdp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)定制開發(fā)、手機(jī)網(wǎng)站建設(shè)建站公司、服務(wù)器托管、網(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í)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司