Unknown Soldier
Mapping a map
- Joined
- Oct 30, 2010
- Messages
- 263
- Solutions
- 11
- Reaction score
- 621
Hi everyone!
I have a little request for those, who are good at php. I have a subpage where all statistics about number of killed monsters are. It works perfectly fine, however I feel it is a little bit too messy, because the table is not sorted in any way. So I would like to ask you for help in adding alpabetical sorting to the list, so the monsters are sorted from A to Z.
If there were a feature that the table could be sorted descending and ascending, it would be perfect!
Thanks in advance!
I have a little request for those, who are good at php. I have a subpage where all statistics about number of killed monsters are. It works perfectly fine, however I feel it is a little bit too messy, because the table is not sorted in any way. So I would like to ask you for help in adding alpabetical sorting to the list, so the monsters are sorted from A to Z.
If there were a feature that the table could be sorted descending and ascending, it would be perfect!
Thanks in advance!
PHP:
<?php
/* Scrip by zonet */
$kills = $config['site']['creatureKills'];
$limit = $config['site']['creatureKillShowLimit'];
$main_content .= '<table border="0px" cellspacing="1px" cellpadding="4px" width="100%">
<TR BGCOLOR="'.$config['site']['vdarkborder'].'" style="color: white;"><th>Creature</th><th>'.$limit.' Top Killers</th></tr>';
$row = 1;
foreach($kills as $name => $storage) {
$qa = $SQL->query('SELECT `player_storage`.`player_id`, `player_storage`.`key`, `player_storage`.`value` AS `value`, `players`.`id`, `players`.`name` AS `name` FROM `player_storage` LEFT JOIN `players` ON `player_storage`.`player_id` = `players`.`id` WHERE `player_storage`.`key` = '.$storage.' ORDER BY ABS(value) DESC LIMIT '.$limit)->fetchAll();
$color = ( $row % 2 ? $config['site']['darkborder'] : $config['site']['lightborder']);
$row++;
$main_content .= '<tr bgcolor="'.$color.'"><td width="40%" style="font-size: 10pt; font-weight: bold; "><center>'.(ucfirst($name)).'</center></td><td>';
$a = 0;
foreach( $qa as $q )
{
$a++;
$main_content .= '<b>'.$a.'.</b> <a href="?subtopic=characters&name='.urlencode($q['name']).'">'.$q['name'].'</a> (Kills: '.$q['value'].') </font></font></font><br />';
}
}
$main_content .= '</td></table>';
?>