Skip to content

Instantly share code, notes, and snippets.

@neokoenig
Created February 5, 2012 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neokoenig/1746957 to your computer and use it in GitHub Desktop.
Save neokoenig/1746957 to your computer and use it in GitHub Desktop.
Get Latest Posts from PHPBB3 to display from another website
<?php
// This gets the latest posts from your PHPBB3 install and outputs them as a UL; results are limited to forum.id's 1,2 and 3 in this example;
$connection = mysql_connect(localhost,"YOURDATABASEUSER","YOURDATABASEPW") or die("Service Currently Unavailable");
$db = mysql_select_db("YOURPHPBB3DATABASENAME",$connection) or die("Service Currently Unavailable");
$sql = "SELECT `phpbb_topics`.`forum_id`, `phpbb_topics`.`topic_id`, `phpbb_topics`.`topic_title`, `phpbb_forums`.`forum_id`, `phpbb_forums`.`forum_name`,`phpbb_forums`.`parent_id` FROM `phpbb_topics`
Inner Join `phpbb_forums` ON `phpbb_forums`.`forum_id` = `phpbb_topics`.`forum_id` WHERE `phpbb_forums`.`parent_id` = 1 OR `phpbb_forums`.`parent_id` = 2 OR `phpbb_forums`.`parent_id` = 2
order by topic_last_post_time desc limit 0,10";
$result = mysql_query($sql) or die("Service Currently Unavailable");
echo "<ul>";
for($x=1;$x<=10;$x++){
$row = mysql_fetch_array($result);
echo "<a href = \"http://YOURFORUMURL/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\" target = \"_blank\">$row[topic_title]</a><br>";
}
echo "</ul>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment