PHP 汽车查询删除
Posted Yao1101
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 汽车查询删除相关的知识,希望对你有一定的参考价值。
主页面
<script src="jquery-1.11.2.min.js"></script> <script src="tanchuang.js"></script> <style type="text/css"> .xq{ background-color:#63F; color:white; } .xq:hover{ background-color:#669; cursor:pointer; color:white; } </style> <link href="tanchuang.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" border="1" cellpadding="0" cellspacing="0" id="xianshi"> </table> </body> <script type="text/javascript"> $(document).ready(function(e) { //显示数据 XianShi(); function XianShi() { $.ajax({ async:false, url:"chuli.php", data:{type:0}, type:"POST", dataType:"TEXT", success: function(data){ var hang = data.split("|"); var str = "<tr><td>代号</td><td>名称</td><td>操作</td></tr>"; for(var i=0;i<hang.length;i++) { var lie = hang[i].split("^"); str+="<tr><td><input type=‘checkbox‘ value=‘"+lie[0]+"‘ class=‘ck‘ />"+lie[0]+"</td><td>"+lie[1]+"</td><td><span class=‘xq‘ bs=‘"+lie[0]+"‘>查看详情</span></td></tr>"; } str+="<tr><td colspan=‘3‘><input type=‘checkbox‘ id=‘qx‘ />全选 <input type=‘button‘ value=‘批量删除‘ id=‘del‘ /></td></tr>"; $("#xianshi").html(str); } }); //查看详情 $(".xq").click(function(){ //取主键值 var code = $(this).attr("bs"); $.ajax({ url:"chuli.php", data:{code:code,type:1}, type:"POST", dataType:"TEXT", success: function(data){ var lie = data.split("^"); var html = "<div>民族代号:"+lie[0]+"</div><div>民族名称:"+lie[1]+"</div>"; var wd = new Window({ width : 400, //宽度 height : 500, //高度 title : ‘详细信息‘, //标题 content : html, //内容 isMask : true, //是否遮罩 buttons :"", //按钮 isDrag:true, }); } }); }) //全选 $("#qx").click(function(){ //全选按钮的选中状态 var xz = $(this)[0].checked; //操作所有的复选框的选中状态 var ck = $(".ck"); ck.prop("checked",xz); }) //删除 $("#del").click(function(){ //找选中的主键值 var ck = $(".ck"); var str = ""; for(var i=0;i<ck.length;i++) { if(ck.eq(i).prop("checked")) { str+=ck.eq(i).val()+"|"; } } str = str.substr(0,str.length-1); $.ajax({ url:"chuli.php", data:{str:str,type:2}, type:"POST", dataType:"TEXT", success: function(data){ alert(data); XianShi(); } }); }) } //给查看详情加点击事件 }); </script> </html>
主页面处理
<?php include("DBDA.php"); $db = new DBDA(); $type = $_POST["type"]; switch($type) { case 0: $sql = "select * from Nation"; echo $db->StrQuery($sql); break; case 1: $code = $_POST["code"]; $sql = "select * from Nation where Code = ‘{$code}‘"; echo $db->StrQuery($sql); break; case 2: $str = $_POST["str"]; $attr = explode("|",$str); $tj = implode($attr,"‘,‘"); $sql = "delete from Nation where Code in (‘{$tj}‘)"; if($db->Query($sql,0)) { echo "删除成功!"; } else { echo "删除失败!"; } break; default: echo ""; }
删除处理页面
<?php include("DBDA.php"); $db = new DBDA(); $str = $_POST["str"]; $attr = explode("|",$str); $tj = implode($attr,"‘,‘"); $sql = "delete from Nation where Code in (‘{$tj}‘)"; if($db->Query($sql,0)) { echo "删除成功!"; } else { echo "删除失败!"; }
详情处理页面
<?php include("DBDA.php"); $db = new DBDA(); $code = $_POST["code"]; $sql = "select * from Nation where Code = ‘{$code}‘"; echo $db->StrQuery($sql);
弹窗css页面
.zhuti { position:absolute; z-index:3; font-size:14px; border-radius:5px; box-shadow:0 0 5px white; overflow:hidden; color:#333; } .title { background-color:#3498db; vertical-align:middle; height:35px; width:100%; line-height:35px; text-indent:1em; } .close{ float:right; width:35px; height:35px; font-weight:bold; line-height:35px; vertical-align:middle; color:white; font-size:18px; } .close:hover { cursor:pointer; } .content { text-indent:1em; padding-top:10px; } .btnx { height:30px; width:100%; text-indent:1em; } .btn { height:28px; width:80px; float:left; margin-left:20px; color:#333; } #zz { width:100%; height:100%; opacity:0.15; display:none; background-color:#ccc; z-index:2; position:absolute; top:0px; left:0px; }
弹窗js页面
// 每个弹窗的标识 var x =0; var idzt = new Array(); var Window = function(config){ //ID不重复 idzt[x] = "zhuti"+x; //弹窗ID //初始化,接收参数 this.config = { width : config.width || 300, //宽度 height : config.height || 200, //高度 buttons : config.buttons || ‘‘, //默认无按钮 title : config.title || ‘标题‘, //标题 content : config.content || ‘内容‘, //内容 isMask : config.isMask == false?false:config.isMask || true, //是否遮罩 isDrag : config.isDrag == false?false:config.isDrag || true, //是否移动 }; //加载弹出窗口 var w = ($(window).width()-this.config.width)/2; var h = ($(window).height()-this.config.height)/2; var nr = "<div class=‘zhuti‘ id=‘"+idzt[x]+"‘ bs=‘"+x+"‘ style=‘width:"+this.config.width+"px; height:"+this.config.height+"px; background-color:white; left:"+w+"px; top:"+h+"px;‘></div>"; $("body").append(nr); //加载弹窗标题 var content ="<div id=‘title"+x+"‘ class=‘title‘ bs=‘"+x+"‘>"+this.config.title+"<div id=‘close"+x+"‘ class=‘close‘ bs=‘"+x+"‘>×</div></div>"; //加载弹窗内容 var nrh = this.config.height - 75; content = content+"<div id=‘content"+x+"‘ bs=‘"+x+"‘ class=‘content‘ style=‘width:100%; height:"+nrh+"px;‘>"+this.config.content+"</div>"; //加载按钮 content = content+"<div id=‘btnx"+x+"‘ bs=‘"+x+"‘ class=‘btnx‘>"+this.config.buttons+"</div>"; //将标题、内容及按钮添加进窗口 $(‘#‘+idzt[x]).html(content); //创建遮罩层 if(this.config.isMask) { var zz = "<div id=‘zz‘></div>"; $("body").append(zz); $("#zz").css(‘display‘,‘block‘); } //最大最小限制,以免移动到页面外 var maxX = $(window).width()-this.config.width; var maxY = $(window).height()-this.config.height; var minX = 0, minY = 0; //窗口移动 if(this.config.isDrag) { //鼠标移动弹出窗 $(".title").bind("mousedown",function(e){ var n = this.getAttribute("bs"); //取标识 //使选中的到最上层 $(".zhuti").css("z-index",3); $(‘#‘+idzt[n]).css("z-index",4); //取初始坐标 var endX = 0, //移动后X坐标 endY = 0, //移动后Y坐标 startX = parseInt($(‘#‘+idzt[n]).css("left")), //弹出层的初始X坐标 startY = parseInt($(‘#‘+idzt[n]).css("top")), //弹出层的初始Y坐标 downX = e.clientX, //鼠标按下时,鼠标的X坐标 downY = e.clientY; //鼠标按下时,鼠标的Y坐标 //绑定鼠标移动事件 $("body").bind("mousemove",function(es){ endX = es.clientX - downX + startX; //X坐标移动 endY = es.clientY - downY + startY; //Y坐标移动 //最大最小限制 if(endX > maxX) { endX = maxX; } else if(endX < 0) { endX = 0; } if(endY > maxY) { endY = maxY; } else if(endY < 0) { endY = 0; } $(‘#‘+idzt[n]).css("top",endY+"px"); $(‘#‘+idzt[n]).css("left",endX+"px"); window.getSelection ? window.getSelection().removeAllRanges():document.selection.empty(); //取消选中文本 }); }); //鼠标按键抬起,释放移动事件 $("body").bind("mouseup",function(){ $("body").unbind("mousemove"); }); } //关闭窗口 $(".close").click(function(){ var m = this.getAttribute("bs"); //找标识 $(‘#‘+idzt[m]).remove(); //移除弹窗 $(‘#zz‘).remove(); //移除遮罩 }) x++; //标识增加 }
以上是关于PHP 汽车查询删除的主要内容,如果未能解决你的问题,请参考以下文章
php 在Yoast SEO中更改或删除OpenGraph输出的代码片段。此代码中有多个代码段。