Here's a little something I used to get the 10 latest posts from a phpBB2 forum and display the topics in a bulleted list. Each list item is a link to the post.
Here's the code:function phpblock_RecentPosts()
{
$link = mysql_connect("$host", "$user", "$pass"
or die ("Could not connect to MySQL"
;
mysql_select_db("$db"
or die("Could not select database"
;
$sql = "SELECT * from phpbb_topics WHERE forum_id=1 ORDER BY `topic_id` ASC LIMIT 0, 10";
$result = mysql_query($sql);
while ($row = mysql_fetch_object($result)) {
$topic = $row->topic_title;
$url .= "<li><a href="/forum/viewtopic.php?t=$row->topic_id">$topic</a></li>";
}
return($url);
mysql_free_result($result);
}
Of course you'll have to fill in YOUR values for $host, $user, $pass, and $db
You'll also need to set forum_id to something other than "1" if you want to pull from a different forum.
You can see my working example at http://teamkarn.net
The block is on the right and titled "Recent Forum Posts"
Enjoy.