• Notice regarding image hosts and attachments. See here.

Extract posts from PHPBB

will that grab just the posts from one forum on the board or every forum in the board? cos i want to grab the topics out of just one of the forums in the entire board not from the entire board
 
ok i am having trouble getting this to work. could someone please write the entire php page and show me it working cos i just get a blank page or a list of jargon when i try any of these.
 
ok i get...

array(33) { [0]=> string(1) "1" ["post_id"]=> string(1) "1" [1]=> string(1) "1" ["topic_id"]=> string(1) "1" [2]=> string(1) "1" ["forum_id"]=> string(1) "1" [3]=> string(1) "2" ["poster_id"]=> string(1) "2" [4]=> string(9) "972086460" ["post_time"]=> string(9) "972086460" [5]=> string(8) "7F000001" ["poster_ip"]=> string(8) "7F000001" [6]=> NULL ["post_username"]=> NULL [7]=> string(1) "1" ["enable_bbcode"]=> string(1) "1" [8]=> string(1) "0" ["enable_html"]=> string(1) "0" [9]=> string(1) "1" ["enable_smilies"]=> string(1) "1" [10]=> string(1) "1" ["enable_sig"]=> string(1) "1" [11]=> NULL ["post_edit_time"]=> NULL [12]=> string(1) "0" ["post_edit_count"]=> string(1) "0" [13]=> string(1) "1" [14]=> string(0) "" ["bbcode_uid"]=> string(0) "" [15]=> NULL ["post_subject"]=> NULL [16]=> string(160) "This is an example post in your phpBB 2 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!" ["post_text"]=> string(160) "This is an example post in your phpBB 2 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!" }

with the following php page...

<html>
<head></head>

<body>

<?php
$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
//select the appropriate database
mysql_select_db('dbname',$link);

$result = mysql_query('
SELECT *
FROM phpbb_posts AS post, phpbb_posts_text AS text
WHERE post.post_id = text.post_id
ORDER BY post.post_time DESC
LIMIT 5
');

while($row = mysql_fetch_array($result)) {
var_dump($row);
}
?>

</body></html>
 
Thrash said:
Here's one I wrote to extract the last post:

PHP:
//get the last article posted on the forum
		$sql = "SELECT * FROM phpbb_posts";
		$result = mysql_query($sql);
		$lastposted=0;
		while($row = mysql_fetch_array( $result )) {
			$timeposted=$row['post_time'];
			if ($timeposted>$lastposted)
			{
				$lastid=$row['post_id'];	
				$lastuserid=$row['poster_id'];
				$lastposted=$timeposted;
			}
		}	
		
		//get the last posted article
		$sql = "SELECT * FROM phpbb_posts_text WHERE post_id=$lastid";
		$result = mysql_query($sql);
		$row = mysql_fetch_array($result);
		$last = $row['post_text'];


i just got blank page when using this guys one along with the db open script
 
Back
Top Bottom