Last Update:2017-09-14
Source: Internet
Author: User
Keywords
Web Programming
PHP Tutorials
<?php Include_once (DirName (__file__). /.. /inc/conn.php '); Include_once (DirName (__file__). /.. /photo/inc/function.php '); ?> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns= "http://www.w3.org/1999/xhtml" > <head> <meta http-equiv= "Content-type" content= "HTML; charset=gb2312 "/> <title> Untitled Document </title> <style type= "Text/css" > <!-- body,td,th { font-size:12px; height:17px; padding:8px 0px 0px 0px; Text-align:center; } Body { margin-left:0px; margin-top:10px; margin-right:0px; margin-bottom:0px; } td{ border:1px solid #333; }
--> </style></head>
<body> <div style= "height:26px;text-align:left; width:98%;font-size:16px; font-weight:bold; margin : 0px auto; ><a href= "export.php" target= "_blank" > Export execel table </a></div> <table width= "cent" border= "0 "align=" center "cellpadding=" 0 "cellspacing=" 0 " <tr> <td width=" 8% " ><strong> account </strong></td> <td width= "14%" ><strong> mailbox </ Strong></td> <td width= "gros" ><strong> gender </strong></td> <td width= "gros" ><strong> baby Birth date </strong></td> < TD width= "12%" ><strong> province </strong></td> <td width= "gros" >< strong> real name </strong></td> <td width= "12%" ><strong> zip code </strong ></td> <td width= "calculated" ><strong> cell phone </sTrong></td> <td width= "21%" ><strong> address </strong></td> </TR> <?php
$sql = "SELECT * FROM TableName"; $result =mysql_query ($sql) or Die (' Fail1 '. mysql_error ()); $rs =mysql_fetch_array ($result); $rdcount =mysql_num_rows ($result); if ($rdcount) { $pagesize = 20; $pagecount = ($rdcount% $pagesize) (int) ($rdcount/$pagesize) + 1: $rdcount/$pagesize;//Statistics Total page $page =isset ($_get[' page ')? $_get[' page ']:1;//get the current page $start = ($page >=1 && $page <= $pagecount)? $start = $pagesize * ($page-1): $start =1;//get a record $start = $start; $sql = $sql. "ORDER BY add_date desc limit $start, $pagesize"; $result =mysql_query ($sql) or Die (Mysql_error ()); while ($rs =mysql_fetch_array ($result)) { echo "<tr> <td> ". $rs [' user_name ']." </td> <td> ". $rs [' User_mail ']." </td> <td> ". $rs [' User_baby_sex ']." </td> <td> ". $rs [' User_baby_birth ']." &nbsp;</td> <td> ". $rs [' Sheng ']." &nbsp;</td> <td> ". $rs [' User_rname ']." &nbsp;</td> <td> ". $rs [' User_zip ']." &nbsp;</td> <td> ". $rs [' User_hand ']." &nbsp;</td> <td> ". $rs [' user_address ']." &nbsp;</td> </tr> "; } echo "<tr> <td colspan=9>"; Pagelist1 ($page, $pagecount, $rdcount, '? page= ', $pagesize); echo "</td> </tr>"; }else{ Echo ' temporarily no information! ' }
Function Pagelist1 ($page, $pagecount, $totalrecord, $url, $pagesize) { if ($page = = "" | | $page > $pagecount) { $page =1 echo (Records. $totalrecord. " Per page ". $pagesize." "$pagecount." Page <a href= ". $url." 1> <<</a> "); if ($page >1) { echo ("<a href=". $url. $page-1). " > < </a> "); } if ($page +9> $pagecount) { $current = $pagecount; &NBSP else { $current = $page +9; } for ($i = $page; $i <= $current; $i + +) { echo ("<a href=". $url. " $i class= ' SF ' > $i </a>); } if ($pagecount > $page) { echo ("<a href=". $url. ( $page + 1). " > > </a> "); } Echo ("<a href=". $url. $pagecount. " > >></a> "); } </table> </body> </html>