RE: [PHP-DB] NEXT - PREVIOUS coding

From: Date: Mon, 16 Jul 2001 10:10:34 +0000
Subject: RE: [PHP-DB] NEXT - PREVIOUS coding
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10440@lists.php.net to get a copy of this message
rough and ready........something like this should work... $pagesize = 20; $page = $page ? $page : 1; $pages = ceil(mysql_num_rows( $results ) / $pagesize ); mysql_data_seek( $results, ($page - 1) * $pagesize ); while( ($row = mysql_fetch_object( $results )) && ( $counter++ < $pagesize) ) { // print rows of data etc etc } if( ($page > 1) ) { print "<a href=?page=".($page + 1).">Next</a>"; } if( ($page < $pages) && ( $pages > 1 ) ) { print "<a href=?page=".($page + 1).">Next</a>"; } -----Original Message----- From: Pranot Kokate [mailto:pp.kokate@godrejcp.com] Sent: 16 July 2001 09:40 To: php-db@lists.php.net Subject: [PHP-DB] NEXT - PREVIOUS coding hi.. friends i have a database (mysql) in which their r many records. Through PHP i want them to display on the page. Main requirement is that there should be a NEXT - PREVIOUS facility. So if there r 20 records and suppose only 10 should show up on scren at a time, then a NEXT link should be visible which could show the remaining 10 records. Their can be n no. of records. Pls help. Kind Regards, Pranot

« previous php.db (#10440) next »