这个php翻页程序错在哪儿
页面出错了,不知道是什么原因?<?phpinclude("head.php");?><?phpinclude("conn.php");$nump=mysql_query(...
页面出错了,不知道是什么原因?
<?php
include ("head.php");
?>
<?php
include ("conn.php");
$nump=mysql_query("select * from message");
$num=mysql_num_rows($nump);
$page=1;
$page=$_GET[page];
$compute=($page-1)*5;
$url="list.php";
$select="select * from message limit $compute,5";
$table=mysql_query($select);
while($row=mysql_fetch_array($table)){
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef" >
<tr bgcolor="#eff3ff">
<td>用户名:<?=$row[user]?>标题:<?=$row[title]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=code($row[content]);?>日期:<?=$row[datetime]?></td>
</tr>
</table>
<?
}
?>
<table align="center"><tr ><td >共<?=$num?>条 <a href=?page=page-1>上一页</a>
<a href=?page=page+1>下一页</a> </td></tr></table>
我改成<a href=?page=$page-1>上一页</a>
<a href=?page=$page+1>下一页</a>也还是不行,但是<a href=?page=4>下一页</a>却可以,不知道什么原因 展开
<?php
include ("head.php");
?>
<?php
include ("conn.php");
$nump=mysql_query("select * from message");
$num=mysql_num_rows($nump);
$page=1;
$page=$_GET[page];
$compute=($page-1)*5;
$url="list.php";
$select="select * from message limit $compute,5";
$table=mysql_query($select);
while($row=mysql_fetch_array($table)){
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef" >
<tr bgcolor="#eff3ff">
<td>用户名:<?=$row[user]?>标题:<?=$row[title]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=code($row[content]);?>日期:<?=$row[datetime]?></td>
</tr>
</table>
<?
}
?>
<table align="center"><tr ><td >共<?=$num?>条 <a href=?page=page-1>上一页</a>
<a href=?page=page+1>下一页</a> </td></tr></table>
我改成<a href=?page=$page-1>上一页</a>
<a href=?page=$page+1>下一页</a>也还是不行,但是<a href=?page=4>下一页</a>却可以,不知道什么原因 展开
展开全部
<?php
include ("head.php");
?>
<?php
include ("conn.php");
$nump=mysql_query("select * from message");
$num=mysql_num_rows($nump);
$page=$_GET['page'];
if(!$page)
{
$page=1;
}
$compute=($page-1)*5;//.............
$url="list.php";
$select="select * from message limit $compute,5";
$table=mysql_query($select);
while($row=mysql_fetch_array($table)){
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef" >
<tr bgcolor="#eff3ff">
<td>用户名:<?=$row[user]?>标题:<?=$row[title]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=code($row[content]);?>日期:<?=$row[datetime]?></td>
</tr>
</table>
<?
}
$nextpage=$page+1;//下页
$prepage=page-1;//前页
?>
<table align="center"><tr ><td >共<?=$num?>条 <a href=?page=<?php echo $prepage;?>>上一页</a>
<a href=?page=<?php echo $nextpage;?>>下一页</a> </td></tr></table>
include ("head.php");
?>
<?php
include ("conn.php");
$nump=mysql_query("select * from message");
$num=mysql_num_rows($nump);
$page=$_GET['page'];
if(!$page)
{
$page=1;
}
$compute=($page-1)*5;//.............
$url="list.php";
$select="select * from message limit $compute,5";
$table=mysql_query($select);
while($row=mysql_fetch_array($table)){
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef" >
<tr bgcolor="#eff3ff">
<td>用户名:<?=$row[user]?>标题:<?=$row[title]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=code($row[content]);?>日期:<?=$row[datetime]?></td>
</tr>
</table>
<?
}
$nextpage=$page+1;//下页
$prepage=page-1;//前页
?>
<table align="center"><tr ><td >共<?=$num?>条 <a href=?page=<?php echo $prepage;?>>上一页</a>
<a href=?page=<?php echo $nextpage;?>>下一页</a> </td></tr></table>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询