The code is below. I'm sure there are much more elegant methods, but it works:
Code:
$result = mysql_query("SELECT postid, username, userid, dateline, pagetext, threadid
FROM post
WHERE visible = 1
ORDER BY dateline DESC
LIMIT 10")
or die('I cannot select from the database because: ' . mysql_error());
while($rows = mysql_fetch_assoc($result)) {
$result_thread = mysql_query("SELECT title,forumid FROM thread WHERE threadid='" . $rows['threadid'] . "'")
or die('I cannot select from the database because: ' . mysql_error());
$rows_thread = mysql_fetch_assoc($result_thread);
$result_forum = mysql_query("SELECT title FROM forum WHERE forumid='" . $rows_thread['forumid'] . "'")
or die('I cannot select from the database because: ' . mysql_error());
$rows_forum = mysql_fetch_assoc($result_forum);
// basic variables required to output latest posts
print $rows_thread['forumid'], $rows_forum['title'], $rows['threadid'], $rows_thread['title'], $rows['pagetext'], $rows['username'], $rows['dateline'];
}
I hope that's helpful.