secondlife
Member
- Joined
- Aug 1, 2009
- Messages
- 298
- Reaction score
- 23
Hi people,
I tried to adapt this Ranking Storage by @imkingran in my project:
AAC - Gesior topfraggers by storage
But i do not want to use by storage. I would like to use only by values contained in table players -> column 'frags'.
Resuming, I'm trying to create a Ranking Kills using a single column.
At this moment, my code is:
The code not works 100% correctly, frag count is OK, but the players names are repeating.
Any idea to fix it? I think the problem is in line:
but i have no idea how to solve it, i tried many times.
If anyone can help me, I will be very grateful.
Thank you!
I tried to adapt this Ranking Storage by @imkingran in my project:
AAC - Gesior topfraggers by storage
But i do not want to use by storage. I would like to use only by values contained in table players -> column 'frags'.
Resuming, I'm trying to create a Ranking Kills using a single column.
At this moment, my code is:
Code:
<?php
$main_content .= '<div style="text-align: center; font-weight: bold;">Top 30 fraggers on ' . htmlspecialchars($config['server']['serverName']) . '</div>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="' . $config['site']['vdarkborder'] . '">
<td class="white" style="text-align: center; font-weight: bold;">Top</td>
<td class="white" style="text-align: center; font-weight: bold;">Name</td>
<td class="white" style="text-align: center; font-weight: bold;">Frags</td>
</tr>';
$i = 0;
foreach($SQL->query("SELECT `frags` FROM `players` WHERE `world_id` = 0 AND `frags` > 0 ORDER BY `frags` DESC LIMIT 30") as $player)
{
$i++;
$pName = $SQL->query('SELECT '.$SQL->fieldName('name').' FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('frags').' > 0')->fetch();
$main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '">
<td style="text-align: center"> '.$i.'.</td>
<td><a href="?subtopic=characters&name=' . urlencode($pName['name']) . '">' . htmlspecialchars($pName['name']) . '</a></td>
<td style="text-align: center;">' .$player['frags'].'</td>
</tr>';
}
$main_content .= '</table>';
?>
The code not works 100% correctly, frag count is OK, but the players names are repeating.
Any idea to fix it? I think the problem is in line:
Code:
$pName = $SQL->query('SELECT '.$SQL->fieldName('name').' FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('frags').' > 0')->fetch();
but i have no idea how to solve it, i tried many times.
If anyone can help me, I will be very grateful.
Thank you!
Last edited: