Hello!
I need some help with this code for showing total members and avg lvls when looking at guilds. Currently it's just showing 0..
Thanks in advance!!
Rep++ for the one who helps x)
I need some help with this code for showing total members and avg lvls when looking at guilds. Currently it's just showing 0..
Code:
$guild_id = (int)$_GET['guild'];
$guildMembers = $SQL->query( 'SELECT COUNT(`gr`.`id`) AS `total` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` = '.$guild_id )->fetch( );
$main_content .= '</TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><center>[B][COLOR="#FF0000"]'.$guildMembers['total'].'[/COLOR][/B]</center></TABLE>
';
$sumav = $SQL->query ('SELECT SUM(`level`) as `level_sum`,AVG(`level`) as `level_avg` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch();
$main_content .= '</TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><center>[B][COLOR="#FF0000"]'.round($sumav['level_avg'].'[/COLOR][/B]</center></TABLE>
</TD></TR>';
Thanks in advance!!
Rep++ for the one who helps x)