我是PHP的初学者,用这样代码所有的数据都出来了,不能分页,望高手帮忙改一下
<?php
include("conn.php");
$soudh=" username='".$_SESSION["username"]."'";
$query="select * from tb_resume_contents where $soudh";
$res=mysql_query($query);
if($res){
while($row=mysql_fetch_array($res)) {
?>
<?php }}?>
<?php
include("conn.php");
$soudh=" username='".$_SESSION["username"]."'";
$query="select * from tb_resume_contents where $soudh";
$res=mysql_query($query);
if($res){
while($row=mysql_fetch_array($res)) {
?>
<?php }}?>
<?php
$sql=mysql_query("select count(*) as total from tb_resume_contents ");
$info=mysql_fetch_array($sql);
$total=$info[total];
if($total==0){
echo "暂无xx!";
}
else{
$pagesize=20;
if ($total<=$pagesize){
$pagecount=1;
}
if(($total%$pagesize)!=0){
$pagecount=intval($total/$pagesize)+1;
}else{
$pagecount=$total/$pagesize;
}
if(($_GET[page])==""){
$page=1;
}else{
$page=intval($_GET[page]);
}
$sql1=mysql_query("select * from tb_resume_contents order by id desc limit ".($page-1)*$pagesize.",$pagesize");
$info1=mysql_fetch_array($sql1);
?> <?php
}while($info1=mysql_fetch_array($sql1))
?>
<?php
echo $total;
?>
条 每页显示 <?php echo $pagesize;?> 条 第 <?php echo $page;?> 页/共 <?php echo $pagecount; ?> 页
<?php
if($page>=2)
{
?>
<a href="该页名称.php?page=1" title="首页"><font face="webdings"> 9 </font></a>
<a href="该页名称.php?id=<?php echo $id;?>&page=<?php echo $page-1;?>" title="前一页"><font face="webdings"> 7 </font></a>
<?php
}
if($pagecount<=4){
for($i=1;$i<=$pagecount;$i++){
?>
<a href="该页名称.php?page=<?php echo $i;?>"><?php echo $i;?></a>
<?php
}
}else{
for($i=1;$i<=4;$i++){
?>
<a href="该页名称.php?page=<?php echo $i;?>"><?php echo $i;?></a>
<?php }?>
<a href="该页名称d.php?page=<?php echo $page-1;?>" title="后一页"><font face="webdings"> 8 </font></a>
<a href="该页名称.php?id=<?php echo $id;?>&page=<?php echo $pagecount;?>" title="尾页"><font face="webdings"> : </font></a>
<?php }?>
<tr>
<td width="774" valign="top"><table width="771" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" style="padding-top:2px;"><table width="756" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="27"><img src="images/neiye_01.jpg" width="27" height="32" /></td>
<td width="723" background="images/neiye_02.jpg" style="padding-top:8px; padding-left:10px;">当前位置:<a href="index.php">首页</a> >> <a href="hy_zl.php">会员中心</a> >> 我的回答 </td>
<td width="15"><img src="images/neiye_03.jpg" width="15" height="32" /></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top" style="background-image:url(images/neiye_02bg.jpg); background-repeat:repeat-y; background-position:right; padding-left:25px;padding-top:10px;padding-bottom:10px;"><div style="overflow:auto; width:740px; padding:8px;padding-left:10px;padding-bottom:5px;">
<table width="720" border="0" cellspacing="1" cellpadding="0" bgcolor="#cccccc">
<tr>
<td width="60" height="23" align="center" valign="middle" bgcolor="#e9f3f9"><span style="font-weight: bold; COLOR: #1b479f;">状态</span></td>
<td width="" align="center" valign="middle" bgcolor="#e9f3f9"><span style="font-weight: bold; COLOR: #1b479f;">问题</span></td>
<td width="110" align="center" valign="middle" bgcolor="#e9f3f9"><span style="font-weight: bold; COLOR: #1b479f;">分类</span></td>
<td width="110" align="center" valign="middle" bgcolor="#e9f3f9"><span style="font-weight: bold; COLOR: #1b479f;">回复/人气</span></td>
<td width="80" align="center" valign="middle" bgcolor="#e9f3f9"><span style="font-weight: bold; COLOR: #1b479f;">时间</span></td>
</tr>
<?php
include("conn.php");
$soudh=" username='".$_SESSION["username"]."'";
$query="select * from tb_resume_contents where $soudh";
$res=mysql_query($query);
if($res){
while($row=mysql_fetch_array($res)) {
?>
<tr>
<td align="center" height="23" bgcolor="#FFFFFF" class="STYLE3"><?php
$sql1=mysql_query("select * from tb_content where id='$row[ljid]'",$conn);
$info1=mysql_fetch_array($sql1);
if ($info1[geifen]=="是")
echo "<img src='images/ok_16x16.gif' />";
else
echo "<img src='images/no_16x16.gif' />";
?></td>
<td align="center" bgcolor="#FFFFFF">
<a href="zthf_index.php?subject=<?php echo urlencode($row[subject]);?>&lmbs=<?php echo $row[ljid];?>" target="_blank"><?php echo $row[subject];?></a> </td>
<td align="center" bgcolor="#FFFFFF" class="STYLE3"><?php echo $row[category];?></td>
<td align="center" bgcolor="#FFFFFF">
<?php $quer="select count(*) as hfjl from tb_resume_contents where id='$row[id]'";
$resul=mysql_query($quer);
$hfjl=mysql_result($resul,0,'hfjl');
echo $hfjl;
?>
/<?php
$sql1=mysql_query("select * from tb_content where id='$row[ljid]'",$conn);
$info1=mysql_fetch_array($sql1);
echo $info1[counts];
?> </td>
<td align="center" bgcolor="#FFFFFF" class="STYLE3"><?php echo $row[resume_date];?></td>
</tr>
<?php }}?>
</table>
</div> </td>
</tr>
<tr>
<td align="right"><table width="756" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="12"><img src="images/neiyebottom_01.jpg" width="13" height="8" /></td>
<td width="729" background="images/neiyebottom_02.jpg"></td>
<td width="15"><img src="images/neiyebottom_03.jpg" width="14" height="8" /></td>
</tr>
</table></td>
</tr>
</table>
<td width="220" valign="top">
关键是自己要理解怎么来的。。怎么去的。。 程序程序。啊
Select Max(ID) From (
Select ID From from Order By ID limit 90000,1
) As tmp
) limit 29;用这种模式会快不少
Select Max(ID) From (
Select ID From table Order By ID limit 90000,1
) As tmp
) limit 29;用这种模式会快不少