Highway of Life wrote:Top 10 Posters of Star Trek Guide
Can I have the code for that? Please? Pretty-please?
-- Roger
Highway of Life wrote:Top 10 Posters of Star Trek Guide


SELECT user_id, username, user_posts
FROM phpbb_users
ORDER BY user_posts
LIMIT 0, 10

Highway of Life wrote:
- Code: Select all
SELECT user_id, username, user_posts
FROM phpbb_users
ORDER BY user_posts
LIMIT 0, 10





Highway of Life wrote:Oh! No, it's actually an image generated by PHP. It uses the JPGraph library.
Here is the code for top posters. But you should be able to adapt it to other graphing scripts as well.
/***
* get top 10 users
***/
function top_ten()
{
global $db;
$sql = 'SELECT username, user_posts FROM phpbb_users ORDER BY ~user_posts LIMIT 0, 10';
$result = $db->sql_query($sql);
$top = '';
while ($row = $db->sql_fetchrow($result))
{
$top .= ($row['username'] . ',' . $row['user_posts']);
}
return $top;
}


Highway of Life wrote:Oh! No, it's actually an image generated by PHP. It uses the JPGraph library.
Here is the code for top posters. But you should be able to adapt it to other graphing scripts as well.








Users browsing this forum: Discovery Bot and 6 guests