PHP_实现分页功能
2010年10月01日 星期五 下午 11:20
$row_free=mysql_fetch_array($info_free);
//如果有记录则显示记录和翻页模块 if($row_free) { do{ echo "<div id='showinfo_wrapper'>"; echo "<div id='showinfo_head'>"; echo "『".$row_free['type']."』 ". $row_free['title']." ". $row_free['edate']; echo "</div>"; echo "<div id='showinfo_body'>"; echo $row_free['content']; echo "</div>"; echo "<div id='showinfo_foot'>"; echo " 联系人:".$row_free['linkman']." 联系电话:" .$row_free['tel']; echo "</div>"; echo "</div>"; }while($row_free=mysql_fetch_array($info_free)); ?> <!--换页模块--> <div id="changPage"> 每页<?php echo $pagesize;?>条 共<?php echo $pages;?>页 当前第<?php echo $curPage;?>页 <a href="<?php if($curPage<=1){ echo "javascript:alert('已经是第一页了!'); "; } else echo $_['PHP_SELF']."?type=".$type."&curPage=1" ; ?>">首页</a> <a href="<?php if($curPage<=1){ echo "javascript:alert('已经是第一页了!'); "; } else echo $_['PHP_SELF']."?type=".$type."&curPage=".($curPage-1) ; ?>">上一页</a> <a href="<?php if(($curPage)==$pages){ echo "javascript:alert('已经是最后一页了!'); "; } else echo $_['PHP_SELF']."?type=".$type."&curPage=".($curPage+1) ; ?>">下一页</a> <a href="<?php if(($curPage)==$pages){ echo "javascript:alert('已经是最后一页了!'); "; } else echo $_['PHP_SELF']."?type=".$type."&curPage=".($pages); ?>">尾页</a> </div> |