How To Extract Latest Posts From phpBB Forums

Google it! / Yahoo it! / Bing it! / Ask it!


I’m talking here about extracting latest posts to a different site. I’m also assuming that the databases are on the same server.

So here is the script:

// connect to the database server

// run The query
$results = mysql_query("SELECT * FROM phpbb_topics ORDER BY topic_time DESC LIMIT 10");
if ($results) {
	while($rand = mysql_fetch_array($results)) {
		echo "<div>";
		echo "<a href='".$rand[0]."' target='_blank' title='Open in new window'>";
		echo $rand[6];
		echo "</a><br /><small>&raquo; added by ".$rand[16]."</small>";
		echo "</div>";
else {
	echo "<p>Error: Forum not available.</p>";


The last line of the script reopens the previous connection, if any. If you don’t use any MySQL databases on your main site, then remove the last database selection line. You should take care and replace phpbb_ with your database prefix (usually phpbb_). You should also change the number of posts you want to extract (10 in my example). Feel free to open the phpbb_topics table and extract new info. I’m using $rand[x] to extract my info, where x is the column number in the phpbb_topics table (starting from 0).

One Response to How To Extract Latest Posts From phpBB Forums

  • is there any way that we can extract one whole section in text format along with php codes? for example there is a ebooks section with 100 posts. if these 100 posts can be extracted in txt file keeping their codes incontact if any…[img], [/code] along with other text if available so that that ready made thing can be posted to some other forum or site


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>