Sorry for yet another question....
http://www.clanrv.worldclanleague.com/index.php?site=timetrials_lc&sort=LC&page=1
Would someone mind telling me how I would go about assigning a number ranking to each entry here, so that the person with the fastest time = #1 and the person with the next fastest time = #2 (etc)?
Example: http://www.ajaxdaddy.com/demo-table-sort.html
Remember that each table column is sortable, so the number (rank) would need to be 'fixed' to the relevant user/time.
Wall of code:
<?php
function clear($text) {
$text=strip_tags($text);
$text=str_replace ("javascript:", "", $text);
$text=$text;
return $text;
}
$alle = safe_query("SELECT userID FROM ".PREFIX."timetrials");
$gesamt = mysql_num_rows($alle);
$maxusers = 10;
$pages = ceil($gesamt/$maxusers);
if(isset($_GET['page'])) $page=(int)$_GET['page'];
else $page = 1;
$sort="LC";
if(isset($_GET['sort'])){
if(($_GET['sort']=='nickname') || ($_GET['sort']=='clantag') || ($_GET['sort']=='LC')) $sort=$_GET['sort'];
}
$type="ASC";
if(isset($_GET['type'])){
if(($_GET['type']=='ASC') || ($_GET['type']=='DESC')) $type=$_GET['type'];
}
if($pages>1) $page_link = makepagelink("index.php?site=timetrials_lc&sort=$sort&type=$type", $page, $pages);
else $page_link='';
if($page == "1") {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."timetrials ORDER BY ".$sort." ".$type." LIMIT 0,".$maxusers);
if($type=="DESC") $n=$gesamt;
else $n=1;
}
else {
$start=$page*$maxusers-$maxusers;
$ergebnis = safe_query("SELECT * FROM ".PREFIX."timetrials ORDER BY ".$sort." ".$type." LIMIT ".$start.",".$maxusers);
if($type=="DESC") $n = ($gesamt)-$page*$maxusers+$maxusers;
else $n = ($gesamt+1)-$page*$maxusers+$maxusers;
}
$jumpmenu='<select name="select_member_type" onchange="MM_jumpMenu(\'parent\',this,0)">
<option value="index.php?site=timetrials_lc">- Show all users -</option>
<option value="index.php?site=timetrials_lc_rv">- Show only Rv members -</option>
</select>
<input type="button" name="Button1" value="go" onclick="MM_jumpMenuGo(\'select_member_type\',\'parent\',0)" class="button" onfocus="blur()" />';
$anz=mysql_num_rows($ergebnis);
if($anz) {
if($type=="ASC")
$sorter = '<a href="index.php?site=timetrials_lc&page='.$page.'&sort='.$sort.'&type=DESC"><img src="images/icons/sort_asc.gif" width="49" height="18" border="0" style="vertical-align:middle;" alt="Sort DESC" /></a>';
else
$sorter = '<a href="index.php?site=timetrials_lc&page='.$page.'&sort='.$sort.'&type=ASC"><img src="images/icons/sort_desc.gif" width="49" height="18" border="0" style="vertical-align:middle;" alt="Sort ASC" /></a>';
eval ("\$timetrials_lc_head = \"".gettemplate("timetrials_lc_head")."\";");
echo $timetrials_lc_head;
$n=1;
while($ds=mysql_fetch_array($ergebnis)) {
$id=$ds['userID'];
$LC = clearfromtags($ds['LC']);
if(isclanmember($ds['userID'])) $nickname = '<a class="timetrials-name" href="index.php?site=profile&id='.$ds['userID'].'"><font style="color:#97D5E2;">'.getnickname($ds['userID']).'</font></a>';
else $nickname = '<a href="index.php?site=profile&id='.$ds['userID'].'">'.strip_tags(stripslashes($ds['nickname'])).'</a>';
$clantag = getclantag($ds['userID']);
eval ("\$timetrials_lc_content = \"".gettemplate("timetrials_lc_content")."\";");
echo $timetrials_lc_content;
$n++;
}
eval ("\$timetrials_lc_foot = \"".gettemplate("timetrials_lc_foot")."\";");
echo $timetrials_lc_foot;
}
else redirect('index.php', $_language->module['user_doesnt_exist'],3);
?>
I'm hoping it's something simple but I have a feeling it isn't :queasy: