Paging i php
Jeg har dette kode hvilket er til at en tagwall(http://www.daneshea.com/tagwall.php) og den virker fint men den gider ikke og page selv om jeg har over 20 inlaeg next linket gaar bare til den samme side som den er paa.if(!$show_from || $show_from < 0) {
$show_from = 0;
}
$pr_page = 20;
$result = "select name, email, message, date_format(time, '%a, %H:%i, %c/%e/%Y') as thetime from tagwall order by time desc limit $show_from, $pr_page";
$sql = mysql_query($result);
$count_amount = "select count(*) as amount from tagwall";
$tag_amount = mysql_query($count_amount);
$tag_amount = mysql_fetch_assoc($tag_amount);
if($tag_amount['amount'] > ($show_from + $pr_page)) {
$next_show_from = $show_from + $pr_page;
$next_nav = "<span class=\"class2\"><a href=\"/tagwall.php?show_from=$next_show_from\">Next</a></span>";
}
else {
$next_nav = "<span class=\"dead-link\">Next</span>";
}
if($show_from > 0 && ($show_from - $pr_page) < $tag_amount['amount']) {
$prev_show_from = $show_from - $pr_page;
$prev_nav = "<span class=\"class2\"><a href=\"/tagwall.php?show_from=$prev_show_from\">Previous</a></span>";
}
else {
$prev_nav = "<span class=\"dead-link\">Previous</span>";
}
$nav = "<p align=\"center\"><table cellpadding=\"4\">
<tr><td align=\"center\">$prev_nav</td><td align=\"center\">$next_nav</td></tr>
</p>";
while ($row = mysql_fetch_array($sql)) {
extract($row);
echo "<table cellpadding=2>";
echo "<tr><td width=50%>Written By: $name</td></tr>";
echo "<tr><td width=50%>Day/Time/Date: $thetime</td></tr>";
echo "<tr><td width=50%>Email: $email</td></tr>";
echo "<tr><td width=50% height=100 cellpadding=10>Message: $message</td></tr></table><br>";
}
echo "$nav";
}