rendered paste body $num = $_GET['num']; if(empty($num)){ $num = 1; }; $limit = 5; $start = ($num-1)*$limit; $query = "SELECT * FROM `main` ORDER by `id` DESC LIMIT $start, $limit"; $result = mysql_query($query); while ($r = mysql_fetch_array($result)){ ?> <h1><?=$r[title]?></h1> <div class="p1"><?=$r[content]?></div> <div class="p1" align="right">Submitted on: <strong><?=$r[date]?></strong></div> <?php }; $totalpages = mysql_num_rows(mysql_query("SELECT * from `main`")); $totalpages = $totalpages / $limit; $totalpages = round($totalpages,0); ?> <br /> <div class="p1" align="right"><strong> <?php $thispage = isset($_GET['num']) ? $_GET['num'] : 1; for($x = 1; $x <= $totalpages; $x++) echo ($x == $thispage) ? " page $x" : " <a href=?num=$x>[$x]</a>";