I have a nice script only, but there are no 1000+ users in the database and they are all shown on 1 page. is it posible to make it posible that only 50 users per page or a number I can allways edit?
| Code: |
<?php
require ("config.php");
?>
<html>
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body topmargin="0"><center>
<?php
include ("menu.php");
?>
<br><br>
<table width="706">
<tr>
<td align="center"><img src="images/<?php echo $alliancebanner;?>"></td>
</tr>
</table>
<table width="706">
<tr>
<th class="race">Race</th>
<th class="name">Name</th>
<th><?php echo $allianceshortcut;?> rank</th>
<th>Army size</th>
<th>KoC rank</th>
</tr>
<?php
if(IsSet($_POST['order'])) {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank {$_POST['direction']}";
} else {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank";
}
$result = mysql_query($query) or die(mysql_error());
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$total_query = "SELECT COUNT(*) FROM ranks_static";
$total_result = mysql_query($total_query) or die($errormsg);
$rank = mysql_result($total_result, 0) or die($errormsg);
} else {
$rank = 1;
}
$bestimprove = 0;
$worstimprove = 0;
$bestcounter = 0;
$worstcounter = 0;
while($row = mysql_fetch_assoc($result)){
if($_POST['order'] == "all" || !IsSet($_POST['order']) || $row['ras'] == $_POST['order']) {
?>
<tr>
<td class="center"> <img src="images/<?echo $row['ras'];?>.jpg"> </td>
<td class="left"><a href="<?echo $row['statlink'];?>" target="_blank"><?echo $row['naam'];?></a></td>
<?php
if(IsSet($row['old'])) {
$diff = $row['old'] - $rank;
if($diff > 0)
$diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$rank} {$diff}</td>";
} else
echo "<td class=\"right\">{$rank} (--) <img src=\"images/stil.gif\"></td>";
if(IsSet($row['armysize']))
echo "<td class=\"right\">{$row['armysize']}</td>";
else
echo "<td class=\"right\">--</td>";
if(IsSet($row['KoC_old'])) {
$diff = $row['KoC_old'] - $row['KoC_rank'];
if($diff > 0)
$KoC_diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$KoC_diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$KoC_diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$row['KoC_rank']} {$KoC_diff}</td>";
} else
echo "<td class=\"right\">{$row['KoC_rank']} (--) <img src=\"images/stil.gif\"></td>";
?></tr><?php
}
$change = $row['oldrank'] - $rank;
if($change > $bestimprove) {
$bestimprove = $row['oldrank'] - $rank;
unset($bestuser);
$bestuser[$bestcounter] = $row['naam'];
} else if($change == $bestimprove && $bestimprove != 0) {
$bestuser[$bestcounter] = $row['naam'];
$bestcounter++;
}
if($change < $worstimprove) {
$worstimprove = $row['oldrank'] - $rank;
unset($worstuser);
$worstuser[$worstcounter] = $row['naam'];
} else if($change == $worstimprove && $worstimprove != 0) {
$worstuser[$worstcounter] = $row['naam'];
$worstcounter++;
}
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$rank--;
} else {
$rank++;
}
}
?>
<tr>
<td class="right_nobar" colspan="5">
Last updated:
<?php
$updates_query = mysql_query("SELECT UNIX_TIMESTAMP(time) AS time FROM times WHERE type = 1") or die($errormsg);
$last_update = mysql_result($updates_query, 0) or die($errormsg);
echo date("d-m-Y, H:i:s", $last_update);
?><br>
<?php
$query = 'SELECT * FROM ranks_static';
$result = mysql_query($query);
$X = mysql_num_rows($result);
echo "Total users in the ranktracker: $X users"
?>
</td>
</tr>
</table>
<br>
<table class="form" width="706">
<tr>
<td class="tdform">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
show:
<select name="order" class="selectbox">
<option value="all" selected="selected">All</option>
<option value="Humans">Humans only</option>
<option value="Dwarves">Dwarves only</option>
<option value="Elves">Elves only</option>
<option value="Orcs">Orcs only</option>
</select>
order:
<select name="direction" class="selectbox">
<option value="ASC" selected="selected">Ascending</option>
<option value="DESC">Desending</option>
</select>
<input type="submit" class="submit" value="Go!">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
|
thanks in advance
//golles
Add this script at the top of your page:
| Code: |
if (!isset($start) OR $start<0)
$start=0;
$step = 50; |
Add this script into your query:
Add this script at the bottom of your page:
| Code: |
$query_count = "SELECT count(*) AS tot_pag FROM table_title";
$result_count = mysql_query($query_count, $db);
$row_count = mysql_fetch_array($result_count);
$pages = intval(($row_count[tot_pag]-1) / $step)+1;
if ($pages>1){
for ($i=0; $i<$pages AND $i<20; $i++) {
$start_page = $i * $step;
echo "<a href=$PHP_SELF?start=$start_page>" . ($i+1) . "</a>";
}
} |
thanks misterdimiz.
I have no idea where I should add the querry part :S (sorry I'm a PHP n00b)
| Code: |
<?
if (!isset($start) OR $start<0)
$start=0;
$step = 50;
?>
<?php
require ("config.php");
?>
<html>
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body topmargin="0"><center>
<?php
include ("menu.php");
?>
<br><br>
<table width="706">
<tr>
<td align="center"><img src="images/<?php echo $alliancebanner;?>"></td>
</tr>
</table>
<table width="706">
<tr>
<th class="race">Race</th>
<th class="name">Name</th>
<th><?php echo $allianceshortcut;?> rank</th>
<th>Army size</th>
<th>KoC rank</th>
</tr>
<?php
if(IsSet($_POST['order'])) {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank {$_POST['direction']}";
} else {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank";
}
$result = mysql_query($query) or die(mysql_error());
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$total_query = "SELECT COUNT(*) FROM ranks_static";
$total_result = mysql_query($total_query) or die($errormsg);
$rank = mysql_result($total_result, 0) or die($errormsg);
} else {
$rank = 1;
}
$bestimprove = 0;
$worstimprove = 0;
$bestcounter = 0;
$worstcounter = 0;
while($row = mysql_fetch_assoc($result)){
if($_POST['order'] == "all" || !IsSet($_POST['order']) || $row['ras'] == $_POST['order']) {
?>
<tr>
<td class="center"> <img src="images/<?echo $row['ras'];?>.jpg"> </td>
<td class="left"><a href="<?echo $row['statlink'];?>" target="_blank"><?echo $row['naam'];?></a></td>
<?php
if(IsSet($row['old'])) {
$diff = $row['old'] - $rank;
if($diff > 0)
$diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$rank} {$diff}</td>";
} else
echo "<td class=\"right\">{$rank} (--) <img src=\"images/stil.gif\"></td>";
if(IsSet($row['armysize']))
echo "<td class=\"right\">{$row['armysize']}</td>";
else
echo "<td class=\"right\">--</td>";
if(IsSet($row['KoC_old'])) {
$diff = $row['KoC_old'] - $row['KoC_rank'];
if($diff > 0)
$KoC_diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$KoC_diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$KoC_diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$row['KoC_rank']} {$KoC_diff}</td>";
} else
echo "<td class=\"right\">{$row['KoC_rank']} (--) <img src=\"images/stil.gif\"></td>";
?></tr><?php
}
$change = $row['oldrank'] - $rank;
if($change > $bestimprove) {
$bestimprove = $row['oldrank'] - $rank;
unset($bestuser);
$bestuser[$bestcounter] = $row['naam'];
} else if($change == $bestimprove && $bestimprove != 0) {
$bestuser[$bestcounter] = $row['naam'];
$bestcounter++;
}
if($change < $worstimprove) {
$worstimprove = $row['oldrank'] - $rank;
unset($worstuser);
$worstuser[$worstcounter] = $row['naam'];
} else if($change == $worstimprove && $worstimprove != 0) {
$worstuser[$worstcounter] = $row['naam'];
$worstcounter++;
}
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$rank--;
} else {
$rank++;
}
}
?>
<tr>
<td class="right_nobar" colspan="5">
Last updated:
<?php
$updates_query = mysql_query("SELECT UNIX_TIMESTAMP(time) AS time FROM times WHERE type = 1") or die($errormsg);
$last_update = mysql_result($updates_query, 0) or die($errormsg);
echo date("d-m-Y, H:i:s", $last_update);
?><br>
<?php
$query = 'SELECT * FROM ranks_static';
$result = mysql_query($query);
$X = mysql_num_rows($result);
echo "Total users in the ranktracker: $X users"
?>
</td>
</tr>
</table>
<br>
<table class="form" width="706">
<tr>
<td class="tdform">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
show:
<select name="order" class="selectbox">
<option value="all" selected="selected">All</option>
<option value="Humans">Humans only</option>
<option value="Dwarves">Dwarves only</option>
<option value="Elves">Elves only</option>
<option value="Orcs">Orcs only</option>
</select>
order:
<select name="direction" class="selectbox">
<option value="ASC" selected="selected">Ascending</option>
<option value="DESC">Desending</option>
</select>
<input type="submit" class="submit" value="Go!">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
<?
$query_count = "SELECT count(*) AS tot_pag FROM ranks_static";
$result_count = mysql_query($query_count, $db);
$row_count = mysql_fetch_array($result_count);
$pages = intval(($row_count[tot_pag]-1) / $step)+1;
if ($pages>1){
for ($i=0; $i<$pages AND $i<20; $i++) {
$start_page = $i * $step;
echo "<a href=$PHP_SELF?start=$start_page>" . ($i+1) . "</a>";
}
}
?> |
please help
//golles
You need to add it to your sql
SELECT UNIX_TIMESTAMP(time) AS time FROM times WHERE type = 1 limit 50
will fetch you only 50 records
wow, this post just made me not want to learn actual codes...
You have to add the query part
at he end of
| Code: |
| $query="SELECT ................... LIMIT $start,$step"; |

it does not work: http://www.golles.frihost.net/KoC/TDO/ranks/index3.php
could you fix it for me?
| Code: |
<?
if (!isset($start) OR $start<0)
$start=0;
$step = 50;
?>
<?php
require ("config.php");
?>
<html>
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body topmargin="0"><center>
<?php
include ("menu.php");
?>
<br><br>
<table width="706">
<tr>
<td align="center"><img src="images/<?php echo $alliancebanner;?>"></td>
</tr>
</table>
<table width="706">
<tr>
<th class="race">Race</th>
<th class="name">Name</th>
<th><?php echo $allianceshortcut;?> rank</th>
<th>Army size</th>
<th>KoC rank</th>
</tr>
<?php
if(IsSet($_POST['order'])) {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank {$_POST['direction']}";
} else {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank";
}
$result = mysql_query($query) or die(mysql_error());
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$total_query = "SELECT COUNT(*) FROM ranks_static LIMIT $start,$step";
$total_result = mysql_query($total_query) or die($errormsg);
$rank = mysql_result($total_result, 0) or die($errormsg);
} else {
$rank = 1;
}
$bestimprove = 0;
$worstimprove = 0;
$bestcounter = 0;
$worstcounter = 0;
while($row = mysql_fetch_assoc($result)){
if($_POST['order'] == "all" || !IsSet($_POST['order']) || $row['ras'] == $_POST['order']) {
?>
<tr>
<td class="center"> <img src="images/<?echo $row['ras'];?>.jpg"> </td>
<td class="left"><a href="<?echo $row['statlink'];?>" target="_blank"><?echo $row['naam'];?></a></td>
<?php
if(IsSet($row['old'])) {
$diff = $row['old'] - $rank;
if($diff > 0)
$diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$rank} {$diff}</td>";
} else
echo "<td class=\"right\">{$rank} (--) <img src=\"images/stil.gif\"></td>";
if(IsSet($row['armysize']))
echo "<td class=\"right\">{$row['armysize']}</td>";
else
echo "<td class=\"right\">--</td>";
if(IsSet($row['KoC_old'])) {
$diff = $row['KoC_old'] - $row['KoC_rank'];
if($diff > 0)
$KoC_diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$KoC_diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$KoC_diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$row['KoC_rank']} {$KoC_diff}</td>";
} else
echo "<td class=\"right\">{$row['KoC_rank']} (--) <img src=\"images/stil.gif\"></td>";
?></tr><?php
}
$change = $row['oldrank'] - $rank;
if($change > $bestimprove) {
$bestimprove = $row['oldrank'] - $rank;
unset($bestuser);
$bestuser[$bestcounter] = $row['naam'];
} else if($change == $bestimprove && $bestimprove != 0) {
$bestuser[$bestcounter] = $row['naam'];
$bestcounter++;
}
if($change < $worstimprove) {
$worstimprove = $row['oldrank'] - $rank;
unset($worstuser);
$worstuser[$worstcounter] = $row['naam'];
} else if($change == $worstimprove && $worstimprove != 0) {
$worstuser[$worstcounter] = $row['naam'];
$worstcounter++;
}
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$rank--;
} else {
$rank++;
}
}
?>
<tr>
<td class="right_nobar" colspan="5">
<?
$query_count = "SELECT count(*) AS tot_pag FROM ranks_static";
$result_count = mysql_query($query_count, $db);
$row_count = mysql_fetch_array($result_count);
$pages = intval(($row_count[tot_pag]-1) / $step)+1;
if ($pages>1){
for ($i=0; $i<$pages AND $i<20; $i++) {
$start_page = $i * $step;
echo "<a href=$PHP_SELF?start=$start_page>" . ($i+1) . "</a>";
}
}
?>
</td>
</tr>
<tr>
<td class="right_nobar" colspan="5">
Last updated:
<?php
$updates_query = mysql_query("SELECT UNIX_TIMESTAMP(time) AS time FROM times WHERE type = 1") or die($errormsg);
$last_update = mysql_result($updates_query, 0) or die($errormsg);
echo date("d-m-Y, H:i:s", $last_update);
?><br>
<?php
$query = 'SELECT * FROM ranks_static';
$result = mysql_query($query);
$X = mysql_num_rows($result);
echo "Total users in the ranktracker: $X users"
?>
</td>
</tr>
</table>
<br>
<table class="form" width="706">
<tr>
<td class="tdform">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
show:
<select name="order" class="selectbox">
<option value="all" selected="selected">All</option>
<option value="Humans">Humans only</option>
<option value="Dwarves">Dwarves only</option>
<option value="Elves">Elves only</option>
<option value="Orcs">Orcs only</option>
</select>
order:
<select name="direction" class="selectbox">
<option value="ASC" selected="selected">Ascending</option>
<option value="DESC">Desending</option>
</select>
<input type="submit" class="submit" value="Go!">
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
|
thanks in advance
//golles
it is difficult if you post all the page's code!
It will take me some time to check what's wrong, but at the moment I have no time. I will take a look as soon as possible.
Hmm, that is a huge code, I suggest tearing apart phpbb's code and finding the script memberlist in it. It should do the same thing if you mod the database table.
ok, thanks misterdimiz.
I will wait.
here is the page: http://www.golles.frihost.net/KoC/TDO/ranks/index3.php
I don't know if it works because I can't test...
If it doesn't work, think to send me also the sql.
Try:
| Code: |
<?
if (!isset($start) OR $start<0)
$start=0;
$step = 50;
require ("config.php");
?>
<html>
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body topmargin="0"><center>
<?
include ("menu.php");
?>
<br><br>
<table width="706">
<tr>
<td align="center"><img src="images/<? echo $alliancebanner; ?>"></td>
</tr>
</table>
<table width="706">
<tr>
<th class="race">Race</th>
<th class="name">Name</th>
<th><?php echo $allianceshortcut;?> rank</th>
<th>Army size</th>
<th>KoC rank</th>
</tr>
<?
if(IsSet($_POST['order'])) {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank {$_POST['direction']} LIMIT $start,$step";
} else {
$query = "SELECT s.idnummer, s.naam, s.statlink, s.ras, d.armysize, d.old, d.KoC_rank, d.KoC_old, w.oldrank FROM ranks_static as s, ranks_dynamic as d, weekly_ranks as w WHERE s.idnummer = d.idnummer AND s.idnummer = w.idnummer ORDER BY d.KoC_rank LIMIT $start,$step";
}
$result = mysql_query($query) or die(mysql_error());
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$total_query = "SELECT COUNT(*) FROM ranks_static";
$total_result = mysql_query($total_query) or die($errormsg);
$rank = mysql_result($total_result, 0) or die($errormsg);
} else {
$rank = 1;
}
$bestimprove = 0;
$worstimprove = 0;
$bestcounter = 0;
$worstcounter = 0;
while($row = mysql_fetch_assoc($result)){
if($_POST['order'] == "all" || !IsSet($_POST['order']) || $row['ras'] == $_POST['order']) {
?>
<tr>
<td class="center"> <img src="images/<?echo $row['ras'];?>.jpg"> </td>
<td class="left"><a href="<?echo $row['statlink'];?>" target="_blank"><?echo $row['naam'];?></a></td>
<?php
if(IsSet($row['old'])) {
$diff = $row['old'] - $rank;
if($diff > 0)
$diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$rank} {$diff}</td>";
} else
echo "<td class=\"right\">{$rank} (--) <img src=\"images/stil.gif\"></td>";
if(IsSet($row['armysize']))
echo "<td class=\"right\">{$row['armysize']}</td>";
else
echo "<td class=\"right\">--</td>";
if(IsSet($row['KoC_old'])) {
$diff = $row['KoC_old'] - $row['KoC_rank'];
if($diff > 0)
$KoC_diff = "(<font class=\"green\">+{$diff}</font>) <img src=\"images/up.gif\">";
else if($diff == 0)
$KoC_diff = "(<font class=\"yellow\">+{$diff}</font>) <img src=\"images/stil.gif\">";
else
$KoC_diff = "(<font class=\"red\">{$diff}</font>) <img src=\"images/down.gif\">";
echo "<td class=\"right\">{$row['KoC_rank']} {$KoC_diff}</td>";
} else
echo "<td class=\"right\">{$row['KoC_rank']} (--) <img src=\"images/stil.gif\"></td>";
?></tr><?php
}
$change = $row['oldrank'] - $rank;
if($change > $bestimprove) {
$bestimprove = $row['oldrank'] - $rank;
unset($bestuser);
$bestuser[$bestcounter] = $row['naam'];
} else if($change == $bestimprove && $bestimprove != 0) {
$bestuser[$bestcounter] = $row['naam'];
$bestcounter++;
}
if($change < $worstimprove) {
$worstimprove = $row['oldrank'] - $rank;
unset($worstuser);
$worstuser[$worstcounter] = $row['naam'];
} else if($change == $worstimprove && $worstimprove != 0) {
$worstuser[$worstcounter] = $row['naam'];
$worstcounter++;
}
if(IsSet($_POST['direction']) && $_POST['direction'] == "DESC") {
$rank--;
} else {
$rank++;
}
}
?>
<tr>
<td class="right_nobar" colspan="5">
<?
$query_count = "SELECT count(*) AS tot_pag FROM ranks_static";
$result_count = mysql_query($query_count);
$row_count = mysql_fetch_array($result_count);
$pages = intval(($row_count[tot_pag]-1) / $step)+1;
if ($pages>1){
for ($i=0; $i<$pages AND $i<20; $i++) {
$start_page = $i * $step;
echo "<a href=$PHP_SELF?start=$start_page>" . ($i+1) . "</a>";
}
}
?>
</td>
</tr>
<tr>
<td class="right_nobar" colspan="5">
Last updated:
<?php
$updates_query = mysql_query("SELECT UNIX_TIMESTAMP(time) AS time FROM times WHERE type = 1") or die($errormsg);
$last_update = mysql_result($updates_query, 0) or die($errormsg);
echo date("d-m-Y, H:i:s", $last_update);
?><br>
<?php
$query = 'SELECT * FROM ranks_static';
$result = mysql_query($query);
$X = mysql_num_rows($result);
echo "Total users in the ranktracker: $X users"
?>
</td>
</tr>
</table>
<br>
<table class="form" width="706">
<tr>
<td class="tdform">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
show:
<select name="order" class="selectbox">
<option value="all" selected="selected">All</option>
<option value="Humans">Humans only</option>
<option value="Dwarves">Dwarves only</option>
<option value="Elves">Elves only</option>
<option value="Orcs">Orcs only</option>
</select>
order:
<select name="direction" class="selectbox">
<option value="ASC" selected="selected">Ascending</option>
<option value="DESC">Desending</option>
</select>
<input type="submit" class="submit" value="Go!">
</form>
</td>
</tr>
</table>
</center>
</body>
</html> |
thanks misterdimiz,
but now it does mess-up with the actual script:
http://www.golles.frihost.net/KoC/TDO/ranks/index3.php
and then goto an other page. every page has a #1
do you have an idea to change that?
Sorry...
Having perl put a number entry at the first db entry, then every 49 after, so a number apears in the field, and some php it is recognized as a number, don't give a link.
while this seems to be sorted may I please amke a small suggestion? Just a space or two between the numbers to improve readability?
change
| Code: |
| echo "<a href=$PHP_SELF?start=$start_page>" . ($i+1) . "</a>"; |
to
| Code: |
| echo " <a href=$PHP_SELF?start=$start_page>" . ($i+1) . "</a> "; |
thanks for the sugestion, but probobly not continue using this coz it only shows the player on the first page with rank 1.
I als prefer using back and next.
//golles