Aviway Posted January 3, 2010 Share Posted January 3, 2010 Hi,I want to build a page that have a lot of articles but I dont want to preview them all, just a 6 at the time.For that I need a script that divide the articles to a lot of pages and show me also "next & previous" bottons. Link to comment Share on other sites More sharing options...
Redroest Posted January 3, 2010 Share Posted January 3, 2010 http://php.about.com/od/phpwithmysql/ss/php_pagination.htm Link to comment Share on other sites More sharing options...
Guest night_elephant Posted April 26, 2010 Share Posted April 26, 2010 guess... It must be something like that:$rowsPerPage = 20;$pageNum = 1;// if $_GET['page'] defined, use it as page numberif(isset($_GET['page'])){ $pageNum = $_GET['page'];}// counting the offset$offset = ($pageNum - 1) * $rowsPerPage;$query = " SELECT val FROM randoms " . " LIMIT $offset, $rowsPerPage";$result = mysql_query($query) or die('Error, query failed');// print the random numberswhile($row = mysql_fetch_array($result)){ echo $row['val'] . '<br>';}but I'm not shure, try look here <snip> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.