<div class="gl_fenye"> <span id="shang">上一页</span> <span id="xia">下一页</span> <span>当前第:<input type="text" id="dq" value="1" style="50px;"/>页</span> <span>总共:<span id="zys"></span>页</span> </div>
$("#shang").click(function(){ var dq = parseInt($("#dq").val()); if(dq>1) { $("#dq").val(dq-1); } else { $("#dq").val(1); } A(); }) //下一页 $("#xia").click(function(){ var dq = parseInt($("#dq").val()); if(dq<$("#zys").text()) { $("#dq").val(dq+1); } else { $("#dq").val($("#zys").text()); } A(); }) ZYS(2); function ZYS(n) { $.ajax({ url:"zong.php", data:{list:n}, type:"POST", dataType:"TEXT", success: function(data) { $("#zys").text(data); } }); }
function A(){ var dq = $("#dq").val(); $.ajax({ async:false, url:"guanlichuli.php", dataType:"TEXT", data:{page:dq}, type:"GET", success: function(data) { var str="<tr style='font-size:15px;'><td>用户名</td><td>密码</td><td>状态</td><td>角色</td><td> 操作</td></tr>"; var s = ""; var hang=data.split("|"); for (var i=0; i<hang.length;i++ ) { var lie= hang[i].split("^"); if(hang.length==1) { a="普通用户"; b="<input type='button' value='修改' class='upd' isok='"+lie[0]+"' style='background:#0C6;'/>"; } else{ if (lie[5]==0) { if(lie[3]==1) { a="普通用户"; b="<input type='button' value='删除' class='del' isok='"+lie[0]+"'> <input type='button' value='修改密码' class='upd' isok='"+lie[0]+"' /> <input type='button' value='停用' class='ting' isok='"+lie[0]+"'>"; } else{ a="普通用户"; b="<input type='button' value='删除' class='del' isok='"+lie[0]+"'/> <input type='button' value='修改密码' class='upd' isok='"+lie[0]+"' /> <input type='button' value='解锁' class='jiesuo' isok='"+lie[0]+"'/>"; } } } if (lie[5]==2) { $("#tianjia").css('display','block'); a="超级管理员"; b=""; } var zt=lie[3]==true?"正常":"已锁定"; var s=s+"<tr bgcolor='#FFF' style='font-size:13px;'><td>"+lie[1]+"</td><td>"+lie[2]+"</td><td>"+zt+"</td><td>"+a+"</td><td>"+b+"</td>"; } str = str + s; $("#xianshi").html(str); }
<?php session_start(); $uid = $_SESSION["uid"]; include("../public/page.class.php"); include("../public/DBDA.class.php"); $db=new DBDA(); $sql = "select count(*) from z_users"; $zs = $db->StrQuery($sql); $page = new Page($zs,2); $sql1="select z_authority from z_users where z_uid='{$uid}'"; $juese = $db->StrQuery($sql1); if($juese==0) { $sql2="select * from z_users where z_uid='{$uid}' ".$page->limit; $attr2 = $db->StrQuery($sql2); echo $attr2; } else{ $sql="select * from z_users ".$page->limit; $attr = $db->StrQuery($sql); echo $attr; }
<?php include("../public/DBDA.class.php"); $db = new DBDA(); $sql ="select count(*) from z_users"; $sj = $db->StrQuery($sql); $list = $_POST["list"]; $zys = 0; if($sj%$list==0) { $zys = $sj/$list; } else { $zys = floor($sj/$list) +1; } echo $zys;