新聞中心
php 刪除數(shù)據(jù)庫(kù)按鈕功能
列清單的代碼不正確,沒(méi)有把編號(hào)作為參數(shù)傳遞給刪除的PHP程序,修改如下:
創(chuàng)新互聯(lián)專注于遼寧企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè)公司,成都做商城網(wǎng)站。遼寧網(wǎng)站建設(shè)公司,為遼寧等地區(qū)提供建站服務(wù)。全流程專業(yè)公司,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)
?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查詢結(jié)果后的刪除按鈕怎么實(shí)現(xiàn)
1:這行代碼代替你的刪除代碼:echo "a href='del.php?id=."$row['sysuser_id']".'刪除/a";
2:建一個(gè)名為del.php文件,在里面寫(xiě)刪除功能
?php
$id = $_GET['id'];//獲取要?jiǎng)h除的ID
//把你的鏈接數(shù)據(jù)庫(kù)代碼寫(xiě)這里
$result = mysql_query("delete from sysuser where sysuser_id = {$id}");
if($result){
echo "刪除成功";
}else{
echo "刪除失敗";
}
php 緊急求助,想實(shí)現(xiàn)點(diǎn)擊刪除按鈕刪除數(shù)據(jù)庫(kù)內(nèi)對(duì)應(yīng)的id信息
?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 } ?
網(wǎng)頁(yè)標(biāo)題:刪除按鈕數(shù)據(jù)庫(kù)php 刪除控件按鈕
標(biāo)題來(lái)源:http://www.dlmjj.cn/article/dodhcco.html