Re: [PHP]Sort Multiple pages
i dont know y it doesnt work
can u merge it on this page ?
Code:
<?
if ($_GET['expand'] == 1){
?>
<tr>
<td width="917" colspan="5" height="26" style="background-image: url('images/subbar.jpg'); 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="128" 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"><img border="0" src="http://forum.ragezone.com/images/subbar/halloffame.jpg" width="93" height="13"></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 50 * FROM Character ORDER BY XP 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.jpg"></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" 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">
<?=number_format($r['XP'],0,'','.');?></td>
<td width="114">
<p align="center">
<span style="font-size: 7pt">
<?=$r['KillCount']?>/<?=$r['DeathCount']?>
(80%)</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 50 * FROM Clan ORDER BY Ranking DESC");
?>
<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/clanraking.jpg" 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" width="417" height="100%">
<? while($r = mssql_fetch_assoc($res)){ ?>
<tr>
<td width="45">
<p align="center">
<?=$r['Ranking']?></td>
<td width="90">
<p align="center">
<b><?=$r['Name']?></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">
79%</td>
<td width="83">
<p align="center">
<?=$r['TotalPoint']?></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>
<?
} }
?>
Re: [PHP]Sort Multiple pages
Re: [PHP]Sort Multiple pages
I'd just recommend you this page:
http://www.select-sql.com/mssql/how-...ssql-2005.html
Mssql doesn't support Limit. You have to make it yourself.
Re: [PHP]Sort Multiple pages
Code:
<?
if ($_GET['expand'] == 1){
?>
<tr>
<td width="917" colspan="5" height="26" style="background-image: url('images/subbar.jpg'); 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="128" 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"><img border="0" src="http://forum.ragezone.com/images/subbar/halloffame.jpg" width="93" height="13"></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 50 * FROM Character ORDER BY XP 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.jpg"></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" 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">
<?=number_format($r['XP'],0,'','.');?></td>
<td width="114">
<p align="center">
<span style="font-size: 7pt">
<?=$r['KillCount']?>/<?=$r['DeathCount']?>
(80%)</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(){
if(!$_GET['highScoreLimit'])
$highScoreLimit = '50';
else {
$highScoreLimit = $_GET['highScoreLimit'];
$totalScoresQuery = mssql_query('SELECT * FROM Clan');
$mssql_num_rows = mssql_num_rows($totalScoresQuery);
$totalScoresPageCount = round($mssql_num_rows/50);
for($i=0;$i<$totalScoresPageCount;$i++) {
$pages[$i] = ($i+1)*50;
echo '<a href="'.$_SERVER['PHP_SELF'].'?highScoreLimit='.$pages[$i].'">'.($i+1).'</a> ';
}
echo '<hr>';
$res = mssql_query('SELECT TOP '.$highScoreLimit.' * FROM Clan WHERE Clan NOT IN(SELECT TOP '.($highScoreLimit-50).' * FROM Clan ORDER BY Ranking DESC) ORDER BY Ranking DESC ');
} ?>
<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/clanraking.jpg" 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" width="417" height="100%">
<? while($r = mssql_fetch_assoc($res)){ ?>
<tr>
<td width="45">
<p align="center">
<?=$r['Ranking']?></td>
<td width="90">
<p align="center">
<b><?=$r['Name']?></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">
79%</td>
<td width="83">
<p align="center">
<?=$r['TotalPoint']?></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>
<?
} }
?>
There I put it in where it should be.. Next time, if it doesn't work, reply with the problem. If there's an error, post the error message. If it works, but the numbers are in the wrong place, just reply and say that. If it does absolutly nothing, then say that. Don't just bump for more help and say it doesn't work....
And I'm not using any mysql, that's MsSQL. I don't have a way to test the query, but I got it from a site where the person had the same problem as you; That is, MsSQL Limit difficulties. Hope this works. Oh, and you do have more than 50 high scores, don't you? If not, then it won't work as you expect since there would only be one page.
Re: [PHP]Sort Multiple pages
@ spn i used ur code and i got this error
Code:
Warning: mssql_fetch_assoc(): supplied argument is not a valid MS SQL-result resource in C:\Xammp\htdocs\web\mod_ranking.php on line 179
Sry for being Afk these many days
Re: [PHP]Sort Multiple pages
That was already there.. I didn't use fetch_assoc(), I used mssql_fetch_row().
Try changing it to mssql_fetch_array() or something... But that was already there. You can try to figure it out, we can't do everything for you :)
Re: [PHP]Sort Multiple pages
xD he didn't code this, its a clan/player ranking script for GunZ he was asking how to do this there also.
Re: [PHP]Sort Multiple pages
well i tried all
nothin worked, i guess ill have to quit this
Thanks for your effort guyz
Re: [PHP]Sort Multiple pages
It's called PHP Pagination.
Sorting MySQL Results Into Pages, Do You Mean That?
Google It ;) Or Try Tutorialized.com, thats how i learnt it.