//...limit $page * 10 ,10
//$result = mysql_query(...);只取出10条记录
$i=0;
echo "<table>";
while($dbRow = mysql_fetch_object($result))
{
if($i%2)
echo "<tr><td>".$dbRow->xxxxxx."</td>";
else
echo "<td>".$dbRow->xxxxxx."</td></tr>";
}
//$result = mysql_query(...);只取出10条记录
$i=0;
echo "<table>";
while($dbRow = mysql_fetch_object($result))
{
if($i%2)
echo "<tr><td>".$dbRow->xxxxxx."</td>";
else
echo "<td>".$dbRow->xxxxxx."</td></tr>";
}
<?
$sql="select * from tA";
$records=mysql_query($sql);
$lastp=Ceil(mysql_num_rows($records)/10);
if($pageno==0 or $pageno>$lastp)
$pageno=$lastp;
$numf=$pageno*10-9;
$numl=$numf+9;
if($pageno==1)
$prep=1;
else
$prep=$pageno-1;
if($pageno==$lastp)
$nextp=$lastp;
else
$nextp=$pageno+1;
$sql="select * from tA where id between '$numf' and '$numl'";
$records=mysql_query($sql);
?>
<form action=<? echo $PHP_SELF;?> method="post">
<table border=0>
<tr>
<td>目前页数:<font color=red><? echo $pageno;?></font>/<font color=blue><? echo $lastp;?></font></td>
<td><a href=<? echo $PHP_SELF;?>?pageno=<? echo $prep;?>>【上一页】</a></td>
<td><a href=<? echo $PHP_SELF;?>?pageno=<? echo $nextp;?>>【下一页】</a></td>
<td><a href=<? echo $PHP_SELF;?>?pageno=1>【第一页】</a></td>
<td><a href=<? echo $PHP_SELF;?>?pageno=<? echo $lastp;?>>【最后一页】</a></td>
<td>输入页数:<input type=text size=3 name=pageno></td>
<td><input type=submit name=SEND VALUE=送出></td>
</tr>
</table>
</form>
<?
echo "<center><table border=1>";
$i=0;
while(List($name)=mysql_fetch_row($records))
{
if($i%2==0)
echo "<tr>";
echo "<td>姓名:</td><td>".$name."</td>";
if($%2==0)
echo "</tr>";
$i++;
}
?>