A simple and practical native PHP pagination class, pagination button style is simple and beautiful, multi-page display time "...", the effect is a lot of website use
The core code is paged
. 1 include_once ( "the config.php" ); 2 require_once ( 'page.class.php'); // paging class . 3 $ showRow = 10; // Number of rows of a display . 4 $ CurPage = empty ( $ _GET [ ' page ']). 1:? $ _GET ['; page '] // the current page, should also be non-digital processing . 5 $ URL "? page page} = {" =; // page address, if there is a search condition . = "? Page Page} = {Q & =" $ _ the GET [ 'Q'] . 6 // code omitted mysql link, add their own testing . 7 $ SQL = "the SELECT ID, Content, AddTime the FROM wishing_wall" ; 8 $total = mysql_num_rows ( the mysql_query ( $ SQL )); // record the total number of pieces . 9 IF (! empty ( $ _GET [ 'Page']) && $ Total ! = 0 && $ CurPage > ceil ( $ Total / $ showRow )) 10 $ CurPage = ceil ( $ TOTAL_ROWS / $ showRow ); // current number of pages is greater than the last pages, taking a last 11 // get data 12 is $ SQL = "the LIMIT" (.. $ CurPage -. 1) * $ showRow . " , $ showRow;"; 13 $query = mysql_query($sql);
Data show page list
1 <ul class="dates"> 2 <?php while ($row = mysql_fetch_array($query)) { ?> 3 <li> 4 <span><?php echo $row['addtime'] ?></span> 5 <a target="_blank" href="http://"><?php echo $row['content'] ?></a> 6 </li> 7 <?php } ?> 8 </ul>
Display paging buttons
. 1 <div class = "the showPage"> 2 <? PHP . 3 IF ( $ Total > $ showRow ) { // total number of records is greater than the page shows the number, the display page . 4 $ Page = new new Page ( $ Total , $ showRow , $ CurPage , $ URL , 2 ); . 5 echo $ Page -> myde_write (); . 6 } . 7 >? . 8 </ div>
This switched: https://www.sucaihuo.com/php/223.html please indicate the source!