<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="Style/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include("conn/conn.php"); //包含conn.php文件
if (isset($_GET['page'])){
$page=$_GET['page'];
}else{
$page=1;
}?>
<?php
if($page){
$page_size=4; //每页显示4条记录
$query="select * from tb_news"; //定义查询语句
$result=mysql_query($query); //执行查询操作
$message_count=mysql_num_rows($result); //获取查询总数
$page_count=ceil($message_count/$page_size); //获取总的页数
$offset=($page-1)*$page_size;
$query="select * from tb_user where id order by id desc limit $offset, $page_size";
$result=mysql_query($query);
}
?>
<form id="form1" name="form1" method="post" action="edit_news_update.php">
<table class="biao">
<tr>
<td width="137">新闻标题</td>
<td width="428">新闻内容</td>
<td width="54">编辑</td>
</tr>
<?php
while ($myrow=mysql_fetch_array($result)){ //使用while循环输出查询结果
?>
<tr>
<td height="102"><?php echo $myrow['name'];?><!--输出新闻标题--></td>
<td><?php echo $myrow['news'];?><!--输出新闻内容--></td>
<td><label>
<input type="hidden" name="id" value="<?php echo $result['id'];?>" />
<div align="center">
<a href="edit_news_update.php?id=<?php echo $result['id'];?>">编辑</a></div>
</label></td>
</tr>
<?php
} //结束while循环
?>
</table>
<?php
if($page!=1){
echo "<a href=index.php?page=1>首页</a>";
echo "<a href=index.php?page=".($page-1).">上一页</a>";
}
if($page<$page_count){
echo " <a href=index.php?page=".($page+1).">下一页</a>";
echo " <a href=index.php?page=$page_count;>尾页</a>";
}
?>
</form>
</body>
</html>
php+mysql
------解决方案--------------------
$query="select * from tb_user where id order by id desc limit $offset, $page_size"; //标红处有问题吧?