本帖最后由 gdljw 于 2013-03-30 11:45:59 编辑
最后搞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 <br />
require_once '../include/config.php';<br>
$connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)<br>
or die('Could not connect to mysql server.');<br>
<br>
mysql_select_db(DB_DATABASE, $connect)<br>
or die('Could not select database.');<br>
?><br>
<br>
<?php <br />
echo '
登入後複製
';
//定义条件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);
?>