Boofo
03-15-2003, 01:13 AM
Can anyone please tell me what would make the following code sometimes give an "thread not specified" error and other times work great? If I update thread counters and then forum counters in the Admin CP, this code works fine. but sometimes if a new message is placed in the thread or a message is moved or deleted, then I start getting the error again on some forums and have to reset the counters to make it work.
// goto newest thread
if ($goto=="newthread") {
if (isset($forumid) and $forumid!=0) {
$foruminfo=verifyid("forum",$forumid,1,1);
$forumid=$foruminfo['forumid'];
$lastthread=$DB_site->query_first("SELECT threadid FROM post WHERE username='".addslashes(htmlspecialchars($foruminfo[lastposter]))."' AND dateline='$foruminfo[lastpost]'");
// $lastthread=$DB_site->fetch_array($DB_site->query("SELECT threadid FROM post WHERE username='".addslashes($foruminfo[lastposter])."' AND dateline='$foruminfo[lastpost]'"));
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
exit;
}
}
and here is the line i use to call the post title
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]" title="Go to first post">$forum[lastthread]</a>
// goto newest thread
if ($goto=="newthread") {
if (isset($forumid) and $forumid!=0) {
$foruminfo=verifyid("forum",$forumid,1,1);
$forumid=$foruminfo['forumid'];
$lastthread=$DB_site->query_first("SELECT threadid FROM post WHERE username='".addslashes(htmlspecialchars($foruminfo[lastposter]))."' AND dateline='$foruminfo[lastpost]'");
// $lastthread=$DB_site->fetch_array($DB_site->query("SELECT threadid FROM post WHERE username='".addslashes($foruminfo[lastposter])."' AND dateline='$foruminfo[lastpost]'"));
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
exit;
}
}
and here is the line i use to call the post title
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]" title="Go to first post">$forum[lastthread]</a>