excuse the title but as im not an expericened programmer i dont know how to describe this problem
So the problem. I have 2 topics in my topics table. When im on thread 2 it correclty prints a thread to thread 1 but when im on thread 1 it doesnt print the link to thread 2.
Whats wrong?
$prev_thread = mysql_query("SELECT MAX(id) as prev_thread_id
FROM topics
WHERE id < $threadid
AND boardid = 1");
$next_thread = mysql_query("SELECT MIN(id) as next_thread_id
FROM topics
WHERE id > $threadid
AND boardid = 1");
$prev = mysql_fetch_assoc($prev_thread);
$next = mysql_fetch_assoc($next_thread);
?>
<?php if ($prev['prev_thread_id']): ?>
<b><a href="<?=URL?>/forum/?action=thread&threadid=<?php echo $prev['prev_thread_id']?>">< Previous Topic</a> </b>
<?php endif ?>
<?php if ($next['next_thread_id']): ?>
<b><a href="<?=URL?>/forum/?action=thread&threadid=<?php echo $next['next_thread_id']?>">Next Topic ></a></b>
<?php endif ?>