php / mysql yeni soru

0 Cevap php

başlık bahane ama im i Yüklü bir expericened programcı bu sorunu açıklamak nasıl bilmiyorum

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.

Ne yanlış?

$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&amp;threadid=<?php echo   $prev['prev_thread_id']?>">< Previous Topic</a>&nbsp;&nbsp;&nbsp;&nbsp;</b>
<?php endif ?>

<?php if ($next['next_thread_id']): ?>
<b><a href="<?=URL?>/forum/?action=thread&amp;threadid=<?php echo    $next['next_thread_id']?>">Next Topic ></a></b>
<?php endif ?>

0 Cevap