Php+SqlServer实现分页显示
发布时间:2006-10-14 2:56:18   收集提供:gaoqian
<html><body><table border=1>
<?
$id=@mssql_connect("ddy","sa"," ") or die("连接不上");
$db=mssql_select_db("ddy",$id);
$query="select * from lr00 order by lr0012 desc";
$result=mssql_query($query);
if($result):
if($tt==""){
$nopa=0;}
else $nopa=$tt;
$gg=mssql_num_rows($result);
echo $gg;
$k=0;
$i=0;
$dd=mssql_fetch_array($result);
if(!$dd){echo '到底了';}
while($dd&&$nopa<=$gg&&$i<3){
if($nopa>=$gg) $nopa=$gg;
@mssql_data_seek($result,$nopa);
$dd=@mssql_fetch_array($result);
if($dd){$nopa++;$i++;
echo "<br>";
echo $dd[1]; }
}
endif;
?></table>
<?if($nopa<$gg){?>
<a href=fenye2.php?tt=<?echo $nopa+1;?>>下一页</a></body></html><?}?>


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50