Jump to content

Latest forum posts


Affix

Recommended Posts

Heres a snippet I use to get the last 5 posts from phpBB to display in my side bar

<?php
require_once('/path/to/forum/config.php');

$link = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname, $link);

$result = mysql_query("SELECT * FROM `phpbb_posts` ORDER BY `post_id` DESC LIMIT 5", $link);


while($r = mysql_fetch_array($result))
{
    echo "<a href=\"http://www.domain.tld/forum/viewtopic.php?p=" . $r['post_id'] . "\">" . $r['post_subject'] . "</a><br />";
}

?>

Link to comment
Share on other sites

  • 2 months later...

actually with a few changes obviously it works...but...its pulling up the subjects of the post but when i click on a subject it takes me to the error page that says the post doesnt exists....what could be possibly wrong?

Link to comment
Share on other sites

  • 2 months later...

This is a great script and I've managed to get as far as Vanity above. But when I click on one of the post links it takes me to a page not found. I'm guessing its the last domain link in the script that I need to change, only I don't know what to.

Any suggestions? Does this need to be a path relative to somewhere on my forum?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...