-
My Clan Ranking
My Clan Ranking is not showing the leaders and this is the code..
Well this is my hole "mod_ranking.php", i am using No_Life's web, but i changed a lot of things though!
PHP Code:
<?
include "config.php";
?>
<?
if ($_GET['expand'] == 1){
?>
<tr>
<td width="917" colspan="5" height="26" style="background-image: url('images/subbar.png'); background-repeat: no-repeat; background-position: center top">
<p align="center">
<a href="index.php?do=ranking&sub=individual&expand=1">
<img border="0" src="images/subbar/individualranking.jpg" width="99" height="13"></a><a href="index.php?do=ranking&sub=clan&expand=1"><img border="0" src="images/subbar/clanranking.jpg" width="99" height="13"></a><a href="index.php?do=ranking&sub=hof&expand=1"></a></td>
</tr>
<? }
if($_GET['expand'] == 0){
switch($_GET['sub']){
case "individual";
ShowIndividualRanking();
break;
case "clan";
ShowClanRanking();
break;
}
}
if(!function_exists("ShowIndividualRanking")){
function ShowIndividualRanking(){
$res = mssql_query("SELECT TOP 100 Name, Level, KillCount, DeathCount, XP FROM Character WHERE Name != '' ORDER BY Level DESC");
$count = 0;
?>
<head>
<meta http-equiv="Content-Language" content="es">
<link rel="stylesheet" type="text/css" href="images/style.css">
</head>
<body bgcolor="#312F30">
<div align="center">
<table border="0" width="456" style="border-collapse: collapse">
<tr>
<td background="images/cont_up.jpg"> </td>
</tr>
<tr>
<td background="images/cont_bg.jpg">
<div align="center">
<table border="0" style="border-collapse: collapse" width="454" height="100%">
<tr>
<td width="4" rowspan="6"> </td>
<td width="436">
<img border="0" src="images/inf/individualranking.png"></td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
<div align="center">
<table border="0" width="421" style="border-collapse: collapse; background-image: url('images/rankinglist.jpg'); background-repeat: no-repeat; background-position: center top">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" height="100%">
<tr>
<td height="30"> </td>
</tr>
<tr>
<td style="background-image: url('images/rankinlist_bg.gif'); background-repeat: repeat; background-position: center top">
<table border="0" style="border-collapse: collapse; font-size: 9px;" width="417" height="100%">
<?
while($r = mssql_fetch_assoc($res)){
$count++;
?>
<tr>
<td width="45">
<p align="center">
<?=$count?></td>
<td width="88">
<p align="center">
<b>
<span class="guild_name">
<?=$r['Name']?></span></b>
</td>
<td width="33">
<p align="center">
<?=$r['Level']?></td>
<td width="127">
<p align="center">
<?=$r['XP']?></td>
<td width="114">
<p align="center">
<span style="font-size: 7pt">
<?=$r['KillCount']?>/<?=$r['DeathCount']?>
</span></td>
</tr> <?}?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434" height="24">
<center>
</center></td>
<td width="8" height="24"> </td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td background="images/cont_top.jpg" height="27"> </td>
</tr>
</table>
</div>
<?
} }
if(!function_exists("ShowClanRanking")){
function ShowClanRanking()
{
$res = mssql_query("SELECT TOP 100 Name, Point, Wins, Losses FROM Clan WHERE Name != '' ORDER BY Point DESC");
$rank = 0;
?>
<body bgcolor="#312F30">
<div align="center">
<table border="0" width="456" style="border-collapse: collapse">
<tr>
<td background="images/cont_up.jpg"> </td>
</tr>
<tr>
<td background="images/cont_bg.jpg">
<div align="center">
<table border="0" style="border-collapse: collapse" width="454" height="100%">
<tr>
<td width="4" rowspan="6"> </td>
<td width="436">
<img border="0" src="images/inf/clanranking.png" width="413" height="17"></td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
<div align="center">
<table border="0" width="421" style="border-collapse: collapse; background-image: url('images/clanranking_list.jpg'); background-repeat: no-repeat; background-position: center top">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" height="100%">
<tr>
<td height="30"> </td>
</tr>
<tr>
<td style="background-image: url('images/clanranking_list_bg.gif'); background-repeat: repeat; background-position: center top">
<table border="0" style="border-collapse: collapse; font-size: 9px;" width="417" height="100%">
<? $rank = 0; ?>
<? while($r = mssql_fetch_assoc($res)){ ?>
<tr>
<td width="45">
<p align="center">
<?=++$rank?></td>
<td width="90">
<p align="center">
<b><?=htmlentities($r['Name'], ENT_QUOTES)?></b></td>
<td width="76">
<p align="center">
<? $res2 = mssql_query("SELECT * FROM Character WHERE CID = '".$r['CID']."'");
$c = mssql_fetch_assoc($res2);
echo $c['Name'];
?></td>
<td width="71">
<p align="center">
<?=$r['Wins']?>/<?=$r['Losses']?></td>
<td width="40">
<p align="center">
<?
$matchTotal = $r['Wins'] + $r['Losses'] + $r['Draws'];
if ($matchTotal > 0)
{
echo(round($r['Wins'] / $matchTotal * 100));
}
else
{
echo(0);
}
?>%</td>
<td width="83">
<p align="center">
<?=$r['Point']?></td>
</tr> <?}?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434" height="24">
<center>
</center></td>
<td width="8" height="24"> </td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td background="images/cont_top.jpg" height="27"> </td>
</tr>
</table>
</div>
<?
} }
?>
What i have to change to make it appear the leaders of the clan? Please help me...
EXAMPLE:
Ranking - Clan Name - Leader - Wins/Losses - Wins% - Points
----2---------Stealth----NOT SHOWING----58/21--------81%-------3586
-
Re: My Clan Ranking
Can you show a bit more of the code
Code:
<? $res2 = mssql_query("SELECT * FROM Character WHERE CID = '".$r['CID']."'");
$c = mssql_fetch_assoc($res2);
echo $c['Name'];
?>
My guess is that your mssql query is only retrieving CID when it should be retrieving the MasterCID from dbo.Clan table
Code:
<? $res2 = mssql_query("SELECT * FROM Character WHERE CID = '".$r['MasterCID']."'");
$c = mssql_fetch_assoc($res2);
echo $c['Name'];
?>
-
Re: My Clan Ranking
Ya, we would need more of the code to check what is going on.
-
Re: My Clan Ranking
Code updated there is my hole ranking "mod_ranking.php"!
@ xTruongx i tried the one you with the MasterCID and didn't worked! Still not showing :(
-
Re: My Clan Ranking
Try this?
Code:
<?
include "config.php";
?>
<?
if ($_GET['expand'] == 1){
?>
<tr>
<td width="917" colspan="5" height="26" style="background-image: url('images/subbar.png'); background-repeat: no-repeat; background-position: center top">
<p align="center">
<a href="index.php?do=ranking&sub=individual&expand=1">
<img border="0" src="http://forum.ragezone.com/images/subbar/individualranking.jpg" width="99" height="13"></a><a href="index.php?do=ranking&sub=clan&expand=1"><img border="0" src="http://forum.ragezone.com/images/subbar/clanranking.jpg" width="99" height="13"></a><a href="index.php?do=ranking&sub=hof&expand=1"></a></td>
</tr>
<? }
if($_GET['expand'] == 0){
switch($_GET['sub']){
case "individual";
ShowIndividualRanking();
break;
case "clan";
ShowClanRanking();
break;
}
}
if(!function_exists("ShowIndividualRanking")){
function ShowIndividualRanking(){
$res = mssql_query("SELECT TOP 100 Name, Level, KillCount, DeathCount, XP FROM Character WHERE Name != '' ORDER BY Level DESC");
$count = 0;
?>
<head>
<meta http-equiv="Content-Language" content="es">
<link rel="stylesheet" type="text/css" href="http://forum.ragezone.com/images/style.css">
</head>
<body bgcolor="#312F30">
<div align="center">
<table border="0" width="456" style="border-collapse: collapse">
<tr>
<td background="http://forum.ragezone.com/images/cont_up.jpg"> </td>
</tr>
<tr>
<td background="http://forum.ragezone.com/images/cont_bg.jpg">
<div align="center">
<table border="0" style="border-collapse: collapse" width="454" height="100%">
<tr>
<td width="4" rowspan="6"> </td>
<td width="436">
<img border="0" src="http://forum.ragezone.com/images/inf/individualranking.png"></td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
<div align="center">
<table border="0" width="421" style="border-collapse: collapse; background-image: url('images/rankinglist.jpg'); background-repeat: no-repeat; background-position: center top">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" height="100%">
<tr>
<td height="30"> </td>
</tr>
<tr>
<td style="background-image: url('images/rankinlist_bg.gif'); background-repeat: repeat; background-position: center top">
<table border="0" style="border-collapse: collapse; font-size: 9px;" width="417" height="100%">
<?
while($r = mssql_fetch_assoc($res)){
$count++;
?>
<tr>
<td width="45">
<p align="center">
<?=$count?></td>
<td width="88">
<p align="center">
<b>
<span class="guild_name">
<?=$r['Name']?></span></b>
</td>
<td width="33">
<p align="center">
<?=$r['Level']?></td>
<td width="127">
<p align="center">
<?=$r['XP']?></td>
<td width="114">
<p align="center">
<span style="font-size: 7pt">
<?=$r['KillCount']?>/<?=$r['DeathCount']?>
</span></td>
</tr> <?}?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434" height="24">
<center>
</center></td>
<td width="8" height="24"> </td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td background="http://forum.ragezone.com/images/cont_top.jpg" height="27"> </td>
</tr>
</table>
</div>
<?
} }
if(!function_exists("ShowClanRanking")){
function ShowClanRanking()
{
$res = mssql_query("SELECT TOP 100 Name, MasterCID, Point, Wins, Losses FROM Clan WHERE Name != '' ORDER BY Point DESC");
$rank = 0;
?>
<body bgcolor="#312F30">
<div align="center">
<table border="0" width="456" style="border-collapse: collapse">
<tr>
<td background="http://forum.ragezone.com/images/cont_up.jpg"> </td>
</tr>
<tr>
<td background="http://forum.ragezone.com/images/cont_bg.jpg">
<div align="center">
<table border="0" style="border-collapse: collapse" width="454" height="100%">
<tr>
<td width="4" rowspan="6"> </td>
<td width="436">
<img border="0" src="http://forum.ragezone.com/images/inf/clanranking.png" width="413" height="17"></td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434">
<div align="center">
<table border="0" width="421" style="border-collapse: collapse; background-image: url('images/clanranking_list.jpg'); background-repeat: no-repeat; background-position: center top">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" height="100%">
<tr>
<td height="30"> </td>
</tr>
<tr>
<td style="background-image: url('images/clanranking_list_bg.gif'); background-repeat: repeat; background-position: center top">
<table border="0" style="border-collapse: collapse; font-size: 9px;" width="417" height="100%">
<? $rank = 0; ?>
<? while($r = mssql_fetch_assoc($res)){ ?>
<tr>
<td width="45">
<p align="center">
<?=++$rank?></td>
<td width="90">
<p align="center">
<b><?=htmlentities($r['Name'], ENT_QUOTES)?></b></td>
<td width="76">
<p align="center">
<? $res2 = mssql_query("SELECT * FROM Character WHERE CID = '".$r['MasterCID']."'");
$c = mssql_fetch_assoc($res2);
echo $c['Name'];
?></td>
<td width="71">
<p align="center">
<?=$r['Wins']?>/<?=$r['Losses']?></td>
<td width="40">
<p align="center">
<?
$matchTotal = $r['Wins'] + $r['Losses'] + $r['Draws'];
if ($matchTotal > 0)
{
echo(round($r['Wins'] / $matchTotal * 100));
}
else
{
echo(0);
}
?>%</td>
<td width="83">
<p align="center">
<?=$r['Point']?></td>
</tr> <?}?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
<td width="8"> </td>
</tr>
<tr>
<td width="434" height="24">
<center>
</center></td>
<td width="8" height="24"> </td>
</tr>
</table>
</div>
</td>
</tr>
<tr><td background="http://forum.ragezone.com/images/cont_top.jpg" height="27"> </td></tr>
</table>
</div>
<?
}
}
?>
Whoops I did not knew you took certain info from dbo.Clan add "MasterCID" to the query
Code:
$res = mssql_query("SELECT TOP 100 Name, MasterCID, Point, Wins, Losses FROM Clan WHERE Name != '' ORDER BY Point DESC");
-
Re: My Clan Ranking
No didn't worked =( still not showing the clan leader!