views:

36

answers:

1

I want to display the most recent posts in a punbb forum on the website home page, does anyone have the php code for this?

A: 

Something like (a very basic example):

$sql = "SELECT `last_post_id` FROM `punbb_forums` WHERE `last_post_id` IS NOT NULL";
$res = mysql_query($sql);
while($row = mysql_fetch_array($res)){
    $sql2 = "SELECT `poster`, `subject` FROM `punbb_topics` WHERE `last_post_id` = ".$row['last_post_id'];
    $res2 = mysql_query($sql2);
    while($row2 = mysql_fetch_array($res2)){
        echo $row2['subject'] . " by " . $row2['poster'] . "<br />";
    }
}
robertbasic