Here is my updated query:
Code:
$q_thread = $DB_site->query("SELECT thread.iconid, icon.title AS icontitle, icon.iconpath, open, thread.title AS threadtitle,
lastpost, postusername,lastposter, views, replycount, fav_threads.userid, fav_threads.threadid,
fav_threads.folderid, folder
FROM fav_threads,thread
LEFT JOIN fav_folders ON (fav_threads.folderid = fav_folders.folderid)
LEFT JOIN icon ON (icon.iconid = thread.iconid)
WHERE fav_threads.userid = 1 AND thread.threadid = fav_threads.threadid
ORDER by folder,thread.title");
I have come up with an optimization for forumdisplay. Did you know that vB runs a query for each thread shown on forumdisplay to retrieve the Name and Path to the message icon (if the thread has one). Using a simple LEFT JOIN you can get that info with the query that retrieves all the threads to begin with. I have incorporated it into my favorites hack.