当前位置:Gxlcms > PHP教程 > 想在分页上添首页和尾页

想在分页上添首页和尾页

时间:2021-07-01 10:21:17 帮助过:30人阅读

想在分页上加首页和尾页

  extract($_REQUEST);
$n=0;
$query=mysql_query("select count(*) as sm from jiaoshi");
mysql_query("set names 'GB2312'");
$row=mysql_fetch_array($query);
$count=$row['sm'];
if(empty($offset))
{$offset=0;}
/*echo $offset;*/
$where = (! isset($surplus)) ? '' : " where surplus='$surplus'";
$query=mysql_query("select * from jiaoshi $where order by id asc limit $offset,$list_num") or die ("fail");
mysql_query("set names 'GB2312'");

while($row=mysql_fetch_array($query)){
if(($n%2)!='0'){
echo "";}
else{
echo "";
}

if($row['surplus']==0)
$ss="不可选";
else $ss="可选";
echo"
".$row['id']."
".$row['subject']."
".$row['teacher']."
".$row['zhicheng']."
".$row['number']."
".$row['xuehao']."
".$ss."
查看
";
$n++;
}

?>

分享到:


------解决方案--------------------
print "首页上一页";}

print("下一页尾页");

居然两个print语句的写法不一样……唉,进步空间很大
------解决方案--------------------
$pageno=floor(($offset/$list_num)+1); //改成这样呢

人气教程排行