Home > Article > Backend Development > 想在分页上添首页和尾页
想在分页上加首页和尾页
<?php<br /> extract($_REQUEST);<br /> $n=0; <br /> $query=mysql_query("select count(*) as sm from jiaoshi");<br /> mysql_query("set names 'GB2312'");<br /> $row=mysql_fetch_array($query);<br /> $count=$row['sm'];<br /> if(empty($offset))<br /> {$offset=0;}<br /> /*echo $offset;*/<br /> $where = (! isset($surplus)) ? '' : " where surplus='$surplus'";<br /> $query=mysql_query("select * from jiaoshi $where order by id asc limit $offset,$list_num") or die ("fail");<br /> mysql_query("set names 'GB2312'");<br /> <br /> while($row=mysql_fetch_array($query)){<br /> if(($n%2)!='0'){<br /> echo "<tr bgcolor=#CDE6C7>";}<br /> else{<br /> echo "<tr bgcolor=#FFFFFF>";<br /> }<br /> <br /> if($row['surplus']==0)<br /> $ss="不可选";<br /> else $ss="可选"; <br /> echo"<br /> <td height='22' class='STYLE1'> <div align='center'> ".$row['id']." </div></td><br /> <td height='22' class='STYLE1'> <div align='center'> ".$row['subject']." </div></td><br /> <td height='22' class='STYLE1'> <div align='center'> ".$row['teacher']." </div></td><br /> <td height='22' class='STYLE1'> <div align='center'> ".$row['zhicheng']." </div></td><br /> <td height='22' class='STYLE1'> <div align='center'> ".$row['number']." </div></td><br /> <td height='22' class='STYLE1'> <div align='center'> ".$row['xuehao']." </div></td><br /> <td height='22' class='STYLE1'> <div align='center'>".$ss."</div></td><br /> <td height='22' class='STYLE1'> <div align='center'> <a href=xiangxiziliao.php?id=".$row['id'].">查看</a></div></td><br /> </tr> ";<br /> $n++;<br /> }<br /> <br /> ?>