PDA

View Full Version : it doesnt make sense...


TECK
05-28-2002, 10:58 AM
this is part of the vbHome lite hack i started. i use this code to pull the threads from a news forum. i have no idea why it's adding an extra query every time i post a new thread:
// ################################################## ####################
// ## NEWS ARTICLES ################################################## ###

$getnewsids=$DB_site->query("SELECT thread.threadid
FROM thread
WHERE thread.forumid=$newsforum
AND thread.visible=1
ORDER BY threadid DESC
LIMIT $newsposts");
$newsids='thread.threadid IN (0';
while ($article=$DB_site->fetch_array($getnewsids)) {
$newsids .= ",".$article['threadid'];
}
$newsids.=')';

$getnews=$DB_site->query("SELECT thread.title,thread.dateline,forumid,postusername, postuserid,post2.pagetext as pagetext
FROM thread
LEFT JOIN post AS post2 ON (thread.articleid=post2.postid)
WHERE $newsids
ORDER BY dateline DESC");
unset($newsbits);
while ($news=$DB_site->fetch_array($getnews)) {
$newstitle=$news[title];
$newstime=vbdate($timeformat,$news[dateline]);
$newsdate=vbdate($dateformat,$news[dateline]);
$newsusername=$news[postusername];
$newsuserid=$news[postuserid];
$newstext=bbcodeparse($news[pagetext],$newsforum,$allowsmilies);

// if you use html code, uncomment the line below
// $newstext=str_replace("<br />","",$newstext);

$newsavatarurl=getavatarurl($newsuserid);
if ($newsavatarurl=='') {
$newsavatarurl='{imagesfolder}/clear.gif';
}

eval("\$newsavatar = \"".gettemplate('home_avatar')."\";");
eval("\$newsbits .= \"".gettemplate('home_newsbits')."\";");
}
$DB_site->free_result($getnews);
unset($news);

// ## END NEWS ARTICLES #################################################
// ################################################## ####################can you help me out and explain why is constantly adding an extra query, with every new post i make? it doesnt make sense to me.

thanks.

Admin
05-28-2002, 11:19 AM
Closed by request of nakkid.