Your original query:-
SELECT phpbb_posts.*,
phpbb_topics.topic_title,
phpbb_topics.topic_replies
FROM phpbb_posts, phpbb_topics
WHERE phpbb_posts.topic_id = phpbb_topics.topic_id
ORDER BY post_time DESC LIMIT 50
At a guess becomes this:-
SELECT phpbb_posts.*,
phpbb_topics.topic_title,
phpbb_topics.topic_replies,
phpbb_forums.forum_id,
phpbb_forums.forum_name
FROM phpbb_posts, phpbb_topics, phpbb_forums
WHERE phpbb_posts.topic_id = phpbb_topics.topic_id
AND phpbb_forums.forum_id = phpbb_topics.forum_id
ORDER BY post_time DESC LIMIT 50
I'm assuming a straightforward table structure of:-
FORUM –< TOPIC –< POSTS
You might want to consider using table alias' as well as it makes
the SQL more readable.
SELECT pp.*,
pt.topic_title,
pt.topic_replies,
pf.forum_id,
pf.forum_name
FROM phpbb_posts pp,
phpbb_topics pt,
phpbb_forums pf
WHERE pp.topic_id = pt.topic_id
AND pf.forum_id = pt.forum_id
ORDER BY pp.post_time DESC LIMIT 50