Heim >Backend-Entwicklung >PHP-Tutorial >请教DWZ PHP网站后台换页问题
dwz php 换页
最后搞PHP+DWZ做网站后台,网上找到这代码,试用正常可以换页,但是我想加一个条件caidid=caidid分页,直接在$sql= "select id,u_id,u_name,last_logintime,last_ip,last_imei,last_phone_number,last_logintype from users where CateId='$CateId2' and $tiaojian like '%$neirong%' order by $orderField {$orderDirection} limit {$fup_page},{$numPerPage}";<?php require_once '../include/config.php';$connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to mysql server.'); mysql_select_db(DB_DATABASE, $connect) or die('Could not select database.');?><?phpecho '<form id="pagerForm" method="post" action="back/user.php"><input name="status" value="'.$status.'" type="hidden"><input name="keywords" value="'.$keywords.'" type="hidden"><input name="pageNum" value="1" type="hidden"><input name="numPerPage" value="'.$numPerPage.'" type="hidden"><input name="CateId2" value="'.$CateId2.'" type="hidden"><input name="orderField" value="'.$orderField.'" type="hidden"><input name="orderDirection" value="'.$orderDirection.'" type="hidden"></form>';//定义条件sql$CateId = get_CateId_by_UId( $UId );$tiaojian = empty($_POST["tiaojian"])?'u_name':$_POST["tiaojian"];$neirong = empty($_POST["keywords"])?"":$_POST["keywords"];$CateId2 = empty($_POST["CateId2"])?'CateId':$_POST["CateId2"];$orderField = empty($_POST["orderField"])?"id":$_POST["orderField"];$query = mysql_query("select * from users");$totalCount = mysql_num_rows($query);$pageNumShown=10;$_POST["pageNum"]!=""?$pageNum=$_POST["pageNum"]:$pageNum=1;$numPerPage=empty($_POST["numPerPage"])?20:$_POST["numPerPage"];$fup_page=($pageNum-1)*$numPerPage;$sql= "select id,u_id,u_name,last_logintime,last_ip,last_imei,last_phone_number,last_logintype from users where $tiaojian like '%$neirong%' order by $orderField {$orderDirection} limit {$fup_page},{$numPerPage}";$result = mysql_query($sql);?><div class="pageHeader"> <form onsubmit="return navTabSearch(this);" action="back/user.php" method="post"> <div class="searchBar"> <table class="searchContent"> <tr> <td> 搜索内容:<input type="text" name="keywords" /> </td> <td> <select class="combox" name="tiaojian"> <option value="u_name">名称</option> <option value="u_id">登录账户</option> </select> </td> </tr> </table> <div class="subBar"> <ul> <li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li> </ul> </div> </div> </form></div><div class="pageContent"> <div class="panelBar"> <ul class="toolBar"> <li><a class="add" href="demo_page4.html" target="navTab"><span>添加项目</span></a></li> </ul> </div> <table class="table" width="100%" layoutH="138"> <thead> <tr> <th width="20" align="center">用户名</th> <th width="50" align="center">名称</th> <th width="30" align="center">最后登录时间</th> <th width="20" align="center">最后登录IP</th> <th width="20" align="center">IMEI码</th> <th width="20" align="center">登录电话号码</th> <th width="10" align="center">登录类型</th> <th width="10" align="center">删除</th> </tr> </thead> <tbody> <?php $i=1; while($row=mysql_fetch_array($result)){ echo'<tr target="sid_user" >'; echo "<td>{$row[1]}</td>"; echo "<td>{$row[2]}</td>"; echo "<td>{$row[3]}</td>"; echo "<td>{$row[4]}</td>"; echo "<td>{$row[5]}</td>"; echo "<td>{$row[6]}</td>"; echo "<td>[<a href='javascript:delusers(".$row[0].")' onClick=\"return confirm('您确定要删除该帐号吗?');\">删除</a>]</td><td>"; echo'</tr>'; $i++; } ?> </tbody> </table> <div class="panelBar"> <div class="pages"> <span>显示</span> <select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})"> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> <option value="200">200</option> </select> <span>条,共<?php echo $totalCount?>条</span> </div> <?php echo '<div class="pagination" targettype="navTab" totalcount="'.$totalCount.'" numperpage="'.$numPerPage.'" pagenumshown="'.$pageNumShown.'" currentpage="'.$pageNum.'"></div>'; if ($_GET["command"] == "del") { if (DB::delUser($_GET["uid"])) { echo "<script>alert('删除成功!');</script>"; }else echo "<script>alert('删除失败!');</script>";}if ($_GET["command"] == "delgroup") { if (DB::deleteGroup($_GET["gid"])) { echo "<script>alert('删除成功!');</script>"; }else echo "<script>alert('删除失败!');</script>";} ?> </div></div><script> function delusers(id){ var u_id =id; $.ajax({ type: "POST", url: "js_helper.php?option=deluser", dataType: "json", data: {"uid":u_id}, success: function(json){ if(json.success==1){alert("删除成功!");}else{alert("删除失败!");} }, error: function(xhr, desc, exception) { alert(xhr + ":" + desc + ":" + exception); } }); }</script>
又是自已解决。。
怎么解决的?
可否给源码参考下?
PHP+DWZ?
我们用的是PHP+