Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code to list newest posts of a forum

    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.

  • #2
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Basically it's so people can post in the forum and I don't personally have to update the mainpage with new messages constantly.

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    Well I've never looked at the PHPbb forum, but this should get you started,

    PHP Code:
    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

  • #4
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You should try phpbbfetchall. It has loads of functions you could add to your site.

    http://www.phpbbfetchall.com/

  • #5
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks guys, when I get off work I'll play around with the code and take a look at that site!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •