
04-15-2005, 12:29 AM
|
 |
|
|
Join Date: May 2003
Location: U of I, Iowa
Posts: 846
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Assuming you'd put this code bit in forumdisplay.php file.
PHP Code:
SELECT forum.forumid, forum.title AS forumtitle, thread.*, post.*
FROM " . TABLE_PREFIX . " thread AS thread
LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "post AS post ON(thread.lastpost = post.postid)
WHERE thread.forumid = '" . intval($forumid) . "'
AND thread.visible = 1
ORDER BY forumtitle
LIMIT 0, 3
Quote:
Originally Posted by Sportbikeworld
I'm trying to pull the last 3 posts from a few forums and then sort the by the forum's name. Here is what I have so far:
SELECT t.threadid, t.title, t.firstpostid, t.lastpost, f.title as forumtitle, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext, t.iconid, t.forumid
FROM thread t
LEFT JOIN post p ON p.postid = t.firstpostid
LEFT JOIN forum f ON f.forumid = t.forumid
WHERE t.forumid
IN ( 19, 116 )
AND t.open = '1'
AND t.visible = '1'
ORDER BY forumtitle DESC
LIMIT 0 , 3
The code above only pull 3 total posts from the forums, any ideas on how to pull the last 3 posts from each forum?
Thanks in advance!
|
|