1

Topic: [REQUEST] - Top 10 Posters

Hello!

I have a question which involves the view of a main site. I don't know if this has been asked earlier, but I searched and couldn't find something relevant.

My question is:

Is it possible to show the top 10 forum posters inside a table on my primary main website, using includes?

If so, could someone please explain how to do this.

Sincerely,

Nnjaa

2

Re: [REQUEST] - Top 10 Posters

I know that this topic is 2 months old, but I think this is quite common task so here's solution:

header('Content-type: text/html; charset=utf-8');

if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', './');
 
require FORUM_ROOT.'include/common.php';

$query = array(
    'SELECT'    => 'u.id, u.username, u.num_posts',
    'FROM'        => 'users AS u',
    'ORDER BY'    => 'u.num_posts DESC',
    'LIMIT'        => '10',
);

$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

echo "<ol>\n\n";
while($user = $forum_db->fetch_assoc($result)) {
    echo "<li>";
     echo "<a href='".forum_link($forum_url['user'], $user['id'])."'>";
      echo $user['username'];
     echo "</a>";
     echo " - ".$user['num_posts'];
    echo "</li>\n";
}
echo "\n</ol>";
Eraversum - scifi browser-based online webgame