Et stk. paging script til dig;
// Et sted i din fil, oppe over dit MySQL udtræk.
$pr_pages = 15; // Antal poster pr. side...
$e = isset($_GET['e'])?$_GET['e']:"";
$a = $pr_pages * $e;
$b = $a + $pr_pages - $e * $pr_pages;
$c = $e - 1;
$d = $e + 1;
$db_database = "minDB";
include ("include/mysql_connect.php");
$foresp = mysql_query("SELECT * FROM table") or die(mysql_error());
$total = mysql_num_rows($foresp);
$pages = $total / $pr_pages;
if($e + 1 < $pages){
$next = " - <a href=\"
http://www.miside.dk/guestbook.php?e=$d\">Næste</a>"; }
if($e - 1 < $pages AND $e){
$prev = "<a href=\"
http://www.minside.dk/guestbook.php?e=$c\">Forrige</a> - ";
} else {
$prev = "Forrige - ";
}
if($d > $pages OR $d=="$pages"){
$next = " - Næste";
}
// Og her, trækker du det ud fra din database, som du ønsker.
$foresp = "SELECT * FROM table order by id DESC LIMIT $a,$b";
// Og her vises resultatet,
echo "<p>\n$prev";
$pages1 = ceil($pages);
$tal = 0;
$tal1 = 1;
while($pages1 >= $tal1) {
if($tal == $e) {
echo "<b>$tal1</b>";
} else {
echo " <a href=\"
http://www.minside.dk/guestbook.php?e=$tal \">$tal1</a> ";
}
$tal++;
$tal1++;
}
echo "$next\n</p>";
}