MyBB Community Forums

Full Version: View post contents from thread outside MyBB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How exactly would I go about showing the post contents from a thread in a page separate from MyBB? The posts need to look exactly like the ones for the thread, but only have the contents.

If needed:
tid = 25
table = ttf_posts
Untested:

$sql="SELECT * FROM ttf_posts WHERE tid=25 ORDER BY pid";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
    echo $rows['message'];
}
Don't forget a php include for the global.php.

Edit: Never mind if you do it he way Kujeo did you'll just have to specify the database.
My code doesn't include the database connect string. Wink
(2010-11-30, 07:53 AM)KuJoe Wrote: [ -> ]Untested:

$sql="SELECT * FROM ttf_posts WHERE tid=25 ORDER BY pid";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
    echo $rows['message'];
}
That was what I have but it doesn't show right, it only renders when in <pre> tags.
(2010-11-30, 12:14 PM)Alex Smith Wrote: [ -> ]Don't forget a php include for the global.php.

Edit: Never mind if you do it he way Kujeo did you'll just have to specify the database.

(2010-11-30, 01:16 PM)KuJoe Wrote: [ -> ]My code doesn't include the database connect string. Wink
Already got the db connection string in place.

Would it be possible to use the MyBB parser to output the posts? And if so, how would I go about doing that?
(2010-11-30, 07:53 AM)KuJoe Wrote: [ -> ]Untested:

$sql="SELECT * FROM ttf_posts WHERE tid=25 ORDER BY pid";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
    echo $rows['message'];
}

mysql_fetch_assoc would be a proper use there!
(2010-12-05, 04:54 PM)dikidera Wrote: [ -> ]
(2010-11-30, 07:53 AM)KuJoe Wrote: [ -> ]Untested:

$sql="SELECT * FROM ttf_posts WHERE tid=25 ORDER BY pid";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
    echo $rows['message'];
}

mysql_fetch_assoc would be a proper use there!
Even so, it pulls exactly what is in the database, which contains no formatting (it's basically just blobs of text with the bbc tags).
im fairly sure you'd be better pulling in global.php and using $Post['message'] or something Smile That way i think it would go through the parser Smile
Okay, thanks. I'll give that a shot tonight, I'll post the results after. Smile
Pages: 1 2