<?php
$sql=mysql_query("select*from db_award",$link);
$info=mysql_fetch_array($sql);
if ($page==""){
$page=1;
}
if (is_numeric($page)){
$page_size=8; //每页显示4条记录
$query="select count(*) as total from db_award order by id desc";
$result=mysql_query($query); //查询符合条件的记录总条数
$message_count=mysql_result($result,0,"total");//要显示的总记录数
$page_count=ceil($message_count/$page_size); //根据记录总数除以每页显示的记录数求出所分的页数
$offset=($page-1)*$page_size;//计算下一页从第几条数据开始循环
$sql=mysql_query("select * from db_award order by id desc limit $offset, $page_size");
$row=mysql_fetch_array($sql);
if(!$row){
echo "<font color='red'>nothing!</font>";
}
do{
?>
<tr align="left" bgcolor="">
<td width="20" height=30"></td>
<td width="250"> <?php echo $info['name'];?></td>
<td width="400" align="center"> <?php echo $info['award'];?></td>
<td width="400" align="center"> <?php echo $info['time'];?></td>
</tr>
<?php
}while($info=mysql_fetch_array($sql));
}
?>
</table>
<table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- 翻页条 -->
<td width="51%">p-m:<?php echo $page;?>/<?php echo $page_count;?>page;Record:<?php echo $message_count;?>stip ; </td>
<td width="49%" align="right">
<?php
/* 如果当前页不是首页 */
if($page!=1){
/* 显示“首页”超链接 */
echo "<a href=award1.php?page=1>first</a> ";
/* 显示“上一页”超链接 */
echo "<a href=award1.php?page=".($page-1).">last</a> ";
}
/* 如果当前页不是尾页 */
if($page<$page_count){
/* 显示“下一页”超链接 */
echo "<a href=award1.php?page=".($page+1).">next</a> ";
/* 显示“尾页”超链接 */
echo "<a href=award1.php?page=".$page_count.">final</a>";
}
mysql_free_result($sql);
?>
</tr>
</table>
可以分页但是 点击next和 final 没反应!!!求哥哥姐姐 赐教!!!
$sql=mysql_query("select*from db_award",$link);
$info=mysql_fetch_array($sql);
if ($page==""){
$page=1;
}
if (is_numeric($page)){
$page_size=8; //每页显示4条记录
$query="select count(*) as total from db_award order by id desc";
$result=mysql_query($query); //查询符合条件的记录总条数
$message_count=mysql_result($result,0,"total");//要显示的总记录数
$page_count=ceil($message_count/$page_size); //根据记录总数除以每页显示的记录数求出所分的页数
$offset=($page-1)*$page_size;//计算下一页从第几条数据开始循环
$sql=mysql_query("select * from db_award order by id desc limit $offset, $page_size");
$row=mysql_fetch_array($sql);
if(!$row){
echo "<font color='red'>nothing!</font>";
}
do{
?>
<tr align="left" bgcolor="">
<td width="20" height=30"></td>
<td width="250"> <?php echo $info['name'];?></td>
<td width="400" align="center"> <?php echo $info['award'];?></td>
<td width="400" align="center"> <?php echo $info['time'];?></td>
</tr>
<?php
}while($info=mysql_fetch_array($sql));
}
?>
</table>
<table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- 翻页条 -->
<td width="51%">p-m:<?php echo $page;?>/<?php echo $page_count;?>page;Record:<?php echo $message_count;?>stip ; </td>
<td width="49%" align="right">
<?php
/* 如果当前页不是首页 */
if($page!=1){
/* 显示“首页”超链接 */
echo "<a href=award1.php?page=1>first</a> ";
/* 显示“上一页”超链接 */
echo "<a href=award1.php?page=".($page-1).">last</a> ";
}
/* 如果当前页不是尾页 */
if($page<$page_count){
/* 显示“下一页”超链接 */
echo "<a href=award1.php?page=".($page+1).">next</a> ";
/* 显示“尾页”超链接 */
echo "<a href=award1.php?page=".$page_count.">final</a>";
}
mysql_free_result($sql);
?>
</tr>
</table>
可以分页但是 点击next和 final 没反应!!!求哥哥姐姐 赐教!!!