Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2006
    Location
    Lancashire, UK
    Posts
    473

    help showing phpbb stats on my homepage

    i showed the stats for the 5 top posters, worked fine.

    PHP Code:

    $sql 
    "SELECT username,user_posts FROM phpbb_users ORDER BY user_posts DESC limit 0,5";

    $res mysql_query($sql);
    echo 
    "<table width=100%>";
    while (
    $row mysql_fetch_array($res)) {

    echo 
    "<td>$row[username]</td><td>$row[user_posts]</td></tr><tr>";


    displayed this

    Code:
    mike 45 
    JPMartin1000 31 
    ghost 20 
    Crash 17 
    scanner 5
    now i was trying to get the most recent posts made

    i want it to display the topic title, and who made the last post. I want to use properly optimized queries such as

    select phpbb_users.userid_id

    rather than

    select *

    this will execute my query faster when the forum tables get very large.

    at the moment i have this:

    PHP Code:
    $sql "

    SELECT phpbb_posts.topic_id,phpbb_topics.topic_title,phpbb_users.user_id,phpbb_users.username 

    FROM phpbb_topics, phpbb_users, phpbb_posts  

    WHERE phpbb_posts.poster_id=phpbb_users.user_id AND phpbb_posts.topic_id=phpbb_topics.topic_id

    GROUP BY phpbb_topics.topic_id

    ORDER by phpbb_posts.post_id  DESC 



    Limit 0, 5"
    ;



    $res mysql_query($sql);
    echo 
    "<table iwdth=100%>";
    while (
    $row mysql_fetch_array($res)) {

    echo 
    "<td>
    <a href=http://www.planet-zorg.co.uk/forum/viewtopic.php?t=
    $row[topic_id] target=_blank><font size=1>$row[topic_title]</font>

    </td>

    <td valign=top>
    $row[username]

    </td>

    </tr><tr>"
    ;



    problem is its showing the topic starter, rahter than the last poster

    is there something im missing?

    the stats are at http://www.planet-zorg.co.uk/mike/

    help me!!!

  2. #2
    Join Date
    Mar 2004
    Posts
    1,301
    without re-inventing the wheel, you can get what you need from
    www.phpbbhacks.com

  3. #3
    Join Date
    Feb 2006
    Location
    Lancashire, UK
    Posts
    473
    it wasnt there, the link was broken

  4. #4
    Join Date
    Dec 2005
    Posts
    82
    the link http://www.phpbbhacks.com/ is working...

  5. #5
    Join Date
    Feb 2006
    Location
    Lancashire, UK
    Posts
    473
    no i meant an internal link to one of their stats hacks

Posting Permissions

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