PDA

View Full Version : More Leaders of the Leaderboard?


maasland
01-23-2009, 07:54 PM
Below is the code (arcade.php) to show 1 Leader of the Leaderboard (avatar + name + total score)
Anyone know how to change this into 3 Leaders of the Leaderboard (avatar + name + total score)?

$DB->query("SELECT mid, gid, sum(position) AS position, sum(points) AS points FROM ibf_games_league GROUP BY mid ORDER BY points DESC LIMIT 1");
$row = $DB->fetch_row();
$points=$row['points'];
$name = "<span class=\"smallfont\"><strong><a href=\"";
$name = $name . $ibforums->base_url."act=Arcade&amp;module=report&amp;user=".$row['mid']."\">";

if ($row['mid'] > 0)
{
$Touruserid = $row['mid'];
$DB->query("SELECT name FROM ibf_members WHERE id=".$Touruserid);
$row = $DB->fetch_row();
$name = $name . $row['name'].'</a></strong></span>';
$tourneyinfo['champ'] = "<b>".$name."</b><br /><span class=\"smallfont\">{$ibforums->lang['tourneyinfo_txt1']}<b>".$points."</b>{$ibforums->lang['tourneyinfo_txt2']}</span>";

$tourneyinfo['champavatar'] = "";

$DB->query("SELECT avatar,avatar_size AS size FROM ibf_members WHERE id=".$Touruserid);

if ($avatar = $DB->fetch_row())
{
$tourneyinfo['champavatar'] = $std->get_avatar($avatar , 1 , $avatar['size']);
if ($tourneyinfo['champavatar'] == "")
{
$tourneyinfo['champavatar'] = "<img src='./arcade/images/noavatar.gif' alt='' />";
}
}
else
{
$tourneyinfo['champavatar'] = "<img src='./arcade/images/noavatar.gif' alt='' />";
}

}
else
{
$tourneyinfo['champ'] = "{$ibforums->lang['top3box_norank']}";
$tourneyinfo['champavatar'] = "";
}

stangger5
01-23-2009, 09:59 PM
Have you tried changing the LIMIT in first line ??

$DB->query("SELECT mid, gid, sum(position) AS position, sum(points) AS points FROM ibf_games_league GROUP BY mid ORDER BY points DESC LIMIT 1");

Change the DESC LIMIT to 3..

maasland
01-23-2009, 10:41 PM
Thanks stangger5, but nope, that alone doesn't work. How would one call 3 different names, avatars and total scores that way? There's no array to take avatar123, total score123, name123 from. Ofcourse the limit should be raised to 3, but that's just step one. Changes should be made to a 'while', if you catch my drift. I just don't know howto exactly...

stangger5
01-23-2009, 10:55 PM
Have a look at this mod,,it might help you or give you a idea on how to do it..

IbproArcade 2.5.7- Top 25 player (https://vborg.vbsupport.ru/showthread.php?t=130264)