• 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!

[0.3.6-0.4] Top fragers and top guilds with one database query

No, iam sure i make the steps right. may be some one can help me and , but all steps in 1 Page.
 
Anyone but me think it would be nice to add a "Latest Frags" and "Latest Deaths" table on the guild page? shows the 10 latest frags/deaths
 
Possible to make "top fragers" show both unjustified and justified kills?
 
Hmm somethink is wrong for me... I cant see anythink... no bug/ no errors ;p / nothing :

123fi.png


My code:

PHP:
<?PHP
//######################## SHOW TICKERS AND NEWS #######################
$main_content .= '<div class="NewsHeadline">
	<div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
		<table border="0">
			<tr>
				<td style="text-align: center; font-weight: bold;">
					<font color="white">Most powerfull guilds</font>
				</td>
			</tr>
		</table>
	</div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
	<tr>';

foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
	`g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
FROM `killers` k
	LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
	LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
	LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
	LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
	GROUP BY `name`
	ORDER BY `frags` DESC, `name` ASC
	LIMIT 0, 4;') as $guild)
	$main_content .= '		<td style="width: 25%; text-align: center;">
			<a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
		</td>';

$main_content .= '	</tr>
</table>';

<!-- Sorry for dubble post... cant edit... -->

I have crated Guild named Administracja

123tj.png


And there its looks like this:
Code:
http://localhost/index.php?subtopic=guilds&action=show&guild=1

123io.png


Any one know what is the problem?
 
Last edited by a moderator:
latestnews section
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1030 Got error 134 from storage engine' in C:\Users\Conglom-osoft\Documents\xampp\htdocs\latestnews.php:36 Stack trace: #0 C:\Users\Conglom-osoft\Documents\xampp\htdocs\latestnews.php(36): PDO->query('SELECT `g`.`id`...') #1 C:\Users\Conglom-osoft\Documents\xampp\htdocs\index.php(100): include('C:\Users\Conglo...') #2 {main} thrown in C:\Users\Conglom-osoft\Documents\xampp\htdocs\latestnews.php on line 36

Frags.php
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1030 Got error 134 from storage engine' in C:\Users\Conglom-osoft\Documents\xampp\htdocs\frags.php:17 Stack trace: #0 C:\Users\Conglom-osoft\Documents\xampp\htdocs\frags.php(17): PDO->query('SELECT `p`.`nam...') #1 C:\Users\Conglom-osoft\Documents\xampp\htdocs\index.php(82): include('C:\Users\Conglo...') #2 {main} thrown in C:\Users\Conglom-osoft\Documents\xampp\htdocs\frags.php on line 17

Yesterday was working fine
 
It just don't show the name of the guild, only: 0 kills and it ever link me to: ?subtopic=guilds&action=show&guild=

So, I get this error:
The Following Errors Have Occurred:
# Guild with ID 0 doesn't exist.
 
nice thnx

//######################## SHOW TICKERS AND NEWS #######################
$main_content .= '<div class="NewsHeadline">
<div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
<table border="0">
<tr>
<td style="text-align: center; font-weight: bold;">
<font color="white">Most powerfull guilds</font>
</td>
</tr>
</table>
</div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
<tr>';
foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
`g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
FROM `killers` k
LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
GROUP BY `name`
ORDER BY `frags` DESC, `name` ASC
LIMIT 0, 4;') as $guild)
$main_content .= ' <td style="width: 25%; text-align: center;">
<a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
</td>';
$main_content .= ' </tr>
</table>';

This is my latestnews i give this before $time = time();
 
Last edited by a moderator:
yeah, now it works, a guild need at least kill 1 to show it
 
Back
Top