Hi
I have developed a forum, which displays posts chronologically. I have
limited the first page to display 20 posts. I want
to provide links to next and previous to access other posts but struck
errors in my attempts.
My query looks like this;
$query = "select * from header where parent = $postid order by posted desc
limit $next, $rpp";
To display the table of messages I am using this code;
display_tree($expanded);
display_prev_next();
The display_tree($expanded) function above is;
function display_prev_next()
{
global $table_width;
?>
<table width = <?=$table_width?> cellpadding = 4 cellspacing = 0>
<?
if(!$result){
$num_msgs = mysql_numrows($result);
$prev = $next - $rpp;
$next += $rpp;
echo"<tr><td colspan='3' bgcolor = '#EEF5FE' align = 'right'>";
if($next <= $num_msgs)echo"<a href=\"forum.php?next=$next\">Older Messages</a>";
if(($next <= $num_msgs) && ($prev >= 0))echo" | ";
if($prev >= 0)echo"<a href=\"forum.php?next=$prev\">Newer Messages</a>";
echo"</td></tr>";
}
?></table><?
}
The links appear to be passing the variable 'next' as 0, rather than the current value of 'next' plus 20.
The forum is at http://www.acpchnqld.org.au/forum/forum.php
I would appreciate any help with this one, it has me stumped.
David