...

View Full Version : Code to list newest posts of a forum



GuyTwo
09-13-2005, 06:56 PM
I want a section on my index page to show the latest posts in a certain category of my PHPbb forum. I can't figure out what code I should be using.

GuyTwo
09-13-2005, 06:59 PM
Basically it's so people can post in the forum and I don't personally have to update the mainpage with new messages constantly.

angst
09-13-2005, 07:24 PM
Well I've never looked at the PHPbb forum, but this should get you started,



Function GetLastPost($PostId) {
global $SqlHost;
global $SqlUser;
global $SqlPass;
global $SqlDb;

$link = mysql_connect($SqlHost, $SqlUser, $SqlPass) or die('Login details incorrect');
$db_selected = mysql_select_db($SqlDb, $link) or die('Database name incorrect');

$result = mysql_query("SELECT * FROM SomeTable WHERE TableId=$PostId ORDER BY FeildName desc");
while ($row = mysql_fetch_assoc($result))
{
echo $row['SomeData'];
}

}



just open the data base for your forum, and try to match up the table and feild names.

-Ken

siriso
09-13-2005, 11:16 PM
You should try phpbbfetchall. It has loads of functions you could add to your site.

http://www.phpbbfetchall.com/

GuyTwo
09-13-2005, 11:31 PM
Thanks guys, when I get off work I'll play around with the code and take a look at that site!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum