Jump to content

Next Previous Script


Aviway

Recommended Posts

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

  • 3 months later...
Guest night_elephant

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...