征集用PHP实现分页显示的方法 建议你搜索一下,已经有很多了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 其实,用过多种方法;想想都一样。 <table border="0" bordercolorlight="#ffffff" bordercolordark="#ffffff" width="98%" cellpadding="0" cellspacing="1"><tr align="center"> <td class="TdMn" width="5%" > </td><td class="TdMn" width="22%" >用户名</td><td class="TdMn" width="30%" >最后一次登录</td><td class="TdMn" width="8%" >次数</td><td class="TdMn" width="22%" >部门</td><td class="TdMn" width="8%" >等级</td></tr><?php //翻页初始化 $PAGE_ROWS=18; $CONFIG->query = "select count(username) as total from users"; $result=db_query("select"); $totalrows=$result[0][total]; $size=$totalrows/$PAGE_ROWS; if ($totalpages=="" and $inpage==""){ $totalpages=ceil($size); $inpage="1"; } //翻页 $limit=($inpage-1)*$PAGE_ROWS.",".$PAGE_ROWS; $CONFIG->query="select * from users order by username desc limit ".$limit; $result=db_query("select"); $rows=count($result)-1; for($i=0;$i<$rows;$i++){ $CONFIG->query="select * from groups where enname='".$result[$i][groupname]."'"; $groupname=db_query("select"); if ($i%2==0){ $class='class="Td1"'; }else{ $class='class="td2"'; } echo ' <tr align="center" '.$class.'> <td width="5%" > <input type="checkbox" name="select'.$i.'" class="ip2" value="yes" onclick="javascript:SetValue(this,\''.$result[$i][username].'\',\''.$result[$i][groupname].'\',\''.$result[$i][admin].'\')"></td> <td width="22%" > '.$result[$i][username].' </td> <td width="30%" > '.$result[$i][lastlogin].' </td> <td width="8%" > '.$result[$i][logincount].' </td> <td width="22%" > '.$groupname[0][cnname].' </td> <td width="8%" > '; switch($result[$i][admin]){ case 1:echo "部门职员"; break; case 2:echo "部门经理"; break; case 3:echo "总经理"; break; } echo ' </td> </tr> '; echo ' <INPUT TYPE="hidden" name="username'.$i.'" value="'.$result[$i][username].'"> <INPUT TYPE="hidden" name="userid'.$i.'" value="'.$result[$i][userid].'"> '; } ?></table><table border="0" bordercolorlight="#ffffff" bordercolordark="#ffffff" width="98%" cellpadding="0" cellspacing="1"><tr><td><?phpif (($inpage!=1)&&($totalpages>1)) echo '<A href="'.$PHP_SELF.'?inpage='.($inpage-1).'&totalpages='.$totalpages.'"><font class="Fnt12px"><上一页</font></A> ';else{ if ($totalpages<=1) echo ' '; else echo '<font color="#A4A4A4" class="Fnt12px"><上一页</font> ';}for ($x=1;$x<=$totalpages;$x++){ if ($x==$inpage) if ($x==1 and $totalpages==1) echo ' '; else echo '<font class="Fnt12pxR"><B>'.$x.'</B></font> '; else echo '<A href="'.$PHP_SELF.'?&inpage='.$x.'&totalpages='.$totalpages.'"><font class="Fnt12px">'.$x.'</font></A></A> ';}if (($inpage!=$totalpages)&&($totalpages>1)) echo '<A href="'.$PHP_SELF.'?inpage='.($inpage+1).'&totalpages='.$totalpages.'"><font class="Fnt12px">下一页></font></A> ';else{ if ($totalpages<=1) echo ' '; else echo '<font color="#A4A4A4" class="Fnt12px">下一页></font> ';}echo ' ';?></td></tr></table> appserv中安装问题 第一次接触php get和post变量的销毁 php除访问mysql外,怎样可以生成$result数据集? Linux服务器PHP读取Excel文件 分页问题?? 请大家帮忙! 请问怎么在php里修改xml文件? 怎样让下拉菜单(设为MULTIPLE)中多个选项同时选中显示出来。 一个很奇怪的问题,我的表单的值为什么不能提交过去..... 十进制转化为二进制问题--100分! !!特急,特急,mysql函数加载的问题!!在线等待!! 求教用php输出照片的问题。
<table border="0" bordercolorlight="#ffffff" bordercolordark="#ffffff" width="98%" cellpadding="0" cellspacing="1">
<tr align="center">
<td class="TdMn" width="5%" > </td>
<td class="TdMn" width="22%" >用户名</td>
<td class="TdMn" width="30%" >最后一次登录</td>
<td class="TdMn" width="8%" >次数</td>
<td class="TdMn" width="22%" >部门</td>
<td class="TdMn" width="8%" >等级</td></tr>
<?php
//翻页初始化
$PAGE_ROWS=18;
$CONFIG->query = "select count(username) as total from users";
$result=db_query("select"); $totalrows=$result[0][total];
$size=$totalrows/$PAGE_ROWS;
if ($totalpages=="" and $inpage==""){
$totalpages=ceil($size);
$inpage="1";
}
//翻页
$limit=($inpage-1)*$PAGE_ROWS.",".$PAGE_ROWS;
$CONFIG->query="select * from users order by username desc limit ".$limit;
$result=db_query("select");
$rows=count($result)-1;
for($i=0;$i<$rows;$i++){
$CONFIG->query="select * from groups where enname='".$result[$i][groupname]."'";
$groupname=db_query("select");
if ($i%2==0){ $class='class="Td1"'; }else{ $class='class="td2"'; }
echo '
<tr align="center" '.$class.'>
<td width="5%" >
<input type="checkbox" name="select'.$i.'" class="ip2" value="yes" onclick="javascript:SetValue(this,\''.$result[$i][username].'\',\''.$result[$i][groupname].'\',\''.$result[$i][admin].'\')"></td>
<td width="22%" > '.$result[$i][username].' </td>
<td width="30%" > '.$result[$i][lastlogin].' </td>
<td width="8%" > '.$result[$i][logincount].' </td>
<td width="22%" >
'.$groupname[0][cnname].' </td>
<td width="8%" >
';
switch($result[$i][admin]){
case 1:echo "部门职员";
break;
case 2:echo "部门经理";
break;
case 3:echo "总经理";
break;
}
echo '
</td>
</tr>
';
echo '
<INPUT TYPE="hidden" name="username'.$i.'" value="'.$result[$i][username].'">
<INPUT TYPE="hidden" name="userid'.$i.'" value="'.$result[$i][userid].'">
';
}
?>
</table>
<table border="0" bordercolorlight="#ffffff" bordercolordark="#ffffff" width="98%" cellpadding="0" cellspacing="1">
<tr>
<td>
<?phpif (($inpage!=1)&&($totalpages>1))
echo '<A href="'.$PHP_SELF.'?inpage='.($inpage-1).'&totalpages='.$totalpages.'"><font class="Fnt12px"><上一页</font></A> ';
else{
if ($totalpages<=1)
echo ' ';
else
echo '<font color="#A4A4A4" class="Fnt12px"><上一页</font> ';
}
for ($x=1;$x<=$totalpages;$x++)
{
if ($x==$inpage) if ($x==1 and $totalpages==1)
echo ' ';
else
echo '<font class="Fnt12pxR"><B>'.$x.'</B></font> ';
else
echo '<A href="'.$PHP_SELF.'?&inpage='.$x.'&totalpages='.$totalpages.'"><font class="Fnt12px">'.$x.'</font></A></A> ';
}
if (($inpage!=$totalpages)&&($totalpages>1))
echo '<A href="'.$PHP_SELF.'?inpage='.($inpage+1).'&totalpages='.$totalpages.'"><font class="Fnt12px">下一页></font></A> ';
else{
if ($totalpages<=1)
echo ' ';
else
echo '<font color="#A4A4A4" class="Fnt12px">下一页></font> ';
}echo ' ';
?>
</td>
</tr>
</table>