<td bgcolor="#CCCCCC" width="99"><div height=" 20" > <div align="center"><span class="style55">ลบ</span><a href="delete.php?id=<?=$objR_s["id"]?>" class="style10"submit=DEL&id_delete=1" onclick="return confirm('กรุณายืนยันการลบอีกครั้ง !!!')"><img src="images/delect.png" width="39" height="38"></a></div> </div> </td>
<? include('connect.php'); $strSQL = "DELETE FROM student "; $strSQL .="WHERE id = '".$_GET["id"]."' "; $objQuery = mysql_query($strSQL); if($objQuery) { echo"<script>"; echo"alert('ลบข้อมูลเรียบร้อยเเล้ว');"; echo"</script>"; exit(""); } else { echo "Error Delete [".$strSQL."]"; } mysql_close($objConnect); ?>
<form id="form" name="form" method="post" action=""> <input type="hidden" name="id" id="id" value="<?php echo '$objR_s["id"]' ;?>" /> <input name="action" type="hidden" id="action" value="delete" /> <input type="submit" name="button3" id="button2" value="ลบ" /> </form>
if(isset($_POST['action']) && $_POST['action'] == 'delete') { $strSQL = "DELETE FROM student "; $strSQL .="WHERE id = '".$_POST["id"]."' "; $objQuery = mysql_query($strSQL); if($objQuery) { echo"<script>"; echo"alert('ลบข้อมูลเรียบร้อยเเล้ว');"; echo"</script>"; exit(""); } else { echo "Error Delete [".$strSQL."]"; } mysql_close($objConnect); }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div class="element"><span class="ele-sub" style="display:inline-block;width:40px;text-align:center" >19</span><span style="display:inline-block;width:100px;text-align:center;" class="ele-sub"> 1138</span> <span style="display:inline-block;width:160px;text-align:center" class="ele-sub">ห้องเตียงเดี่ยว พัดลม</span> <span style="display:inline-block;width:140px;text-align:right;" class="ele-sub">อาคารที่ </span> <span style="display:inline-block;width:60px;" class="ele-sub"><img src="action_delete.png" class="deleteRoom" rel="1138" /></span></div> <div id="result"></div>> <script> $("img.deleteRoom").click(function(){ var delID = $(this).attr("rel"); if(confirm("คุณต้องการลบห้องหมายเลข:"+delID)){ $(this).parents("div:first").css({"color":"red"}).children().css({"text-decoration":"line-through"}); $.post("room_delete.php",{roomno_del:delID},function(returnData){ $("div#result").empty().html(returnData).css({"color":"red"}).show(500).hide(500); }); } }); </script> </body> </html>
<?php session_start(); require_once("myfunction.php"); $newCon = new DBs(); $newCon->connect(); $sql = "select * from room_type "; $newCon->dbquery($sql); while($data = $newCon->fetch_assoc()){ $roomTypeArr[$data["id"]] = "{$data["room_name"]}"; } if(isset($_POST["roomno_del"])){ $sql1 = "delete from room where roomno='{$_POST["roomno_del"]}'"; $newCon->dbquery($sql1); if($newCon->affected_rows()){ echo "คุณลบข้อมูลสำเร็จแล้วค่ะ" } } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง