PDA

View Full Version : Latest Thread Query (on every page) - Is there a better way?


kall
03-03-2005, 04:57 PM
Hellooo!

At the moment, the query is running inside my phpinclude_start template, and is pretty much just:

$headerposts = $DB_site -> query ("SELECT post.postid,post.username,post.title,post.userid,p ost.dateline,thread.title as threadtitle,thread.threadid,thread.forumid
FROM ".TABLE_PREFIX."post AS post
LEFT JOIN ".TABLE_PREFIX."thread AS thread ON thread.threadid=post.threadid
WHERE thread.visible=1
ORDER BY post.dateline DESC
LIMIT 0,50");


There's more, but that's the gist of it.

It would be nice if I could optimise it a bit...is the data I need (latest thread/latest post-title, url, posted by.) available any other way? Possibly using the datastore?

Dean C
03-03-2005, 08:17 PM
Yeah, use the datastore every 5mins or so I'd say :)

kall
03-04-2005, 05:17 AM
Yeah, use the datastore every 5mins or so I'd say :)
Right, sweet.

...

...

How do I do that? :)