• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Sql query question :)

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
Im going to make some new gesior scripts i need just a help.

PHP:
 $guild_id = (int)$_GET['guild'];
$point = $SQL->query('
        SELECT 
            `g`.`id` AS `id`,
            `g`.`name` AS `name`,
            SUM(`p`.`level`) AS `level`,
            COUNT(`p`.`name`) AS `count`,
            AVG(`p`.`level`) AS `average`,
            MIN(`p`.`level`) AS `min`,
            MAX(`p`.`level`) AS `max`
        FROM `players` p
            LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
            LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
        WHERE `guild_id` = '.$guild_id.'
    ')->fetch();
	$Points = $point['level'] + $point['count'] + round($point['average']) + $point['min'] + $point['max'];

This is in guild page. It should display points in each guild. How to show the correct output? I had this script for global checking top 3 guilds and I think its sth wrong when it comes to pointing a guild

Thanks and see the release soon.
 
Back
Top