
ich habe ein kleines Problem bei der Erstellung einer Rangliste.
Ich habe es schon soweit hinbekommen das ich eine Liste erstelle und diese auch richtig nach Anzahl der Scans sortiert wird.
Mein Problem liegt aber daran, das ich absolut nicht weiß, wie ich es anstellen muss, dass auch die Rangzahl ausgegeben wird.
Das ist das aktuelle Script:
Code: Alles auswählen
/*** Rankings ***/
if ($rankings == 1) {
$sql = "SELECT
ID,
Nick,
IGNick,
RLName,
Feind,
Scans
FROM
".SPIELER."
WHERE 1
AND Feind = 0
ORDER BY
Scans DESC;";
$result = mysql_query($sql) OR die(mysql_error());
$nicks = array();
$ids = array();
$scans = array(); // gibt die Einzelscans des Spielers an
$eintraege_spieler = 0;
while($row = mysql_fetch_assoc($result)) {
$nicks[] = $row[getDarstellNick($_SESSION['ID'])];
$ids[] = $row['ID'];
$scans[] = $row['Scans'];
$eintraege_spieler++;
}
// Rankingtabelle erzeugen
echo " <h2>Rankings</h2>
<table border=\"1\" width=\"40%\">
<colgroup>
<col width=\"1*\">
<col width=\"4*\">
<col width=\"1*\">
</colgroup>
<tr>
<th>Platz</th>
<th>Spieler</th>
<th>Scans</th>
</tr>";
for ($i=0; $i<$eintraege_spieler; $i++) {
echo " <tr>
<td align=\"center\"></td>
<td align=\"center\">".$nicks[$i]."</td>
<td align=\"center\">".$scans[$i]."</td>
</tr>";
}
echo "</table></body></html>";
}
Ich hoffe das mir hier jemand weiterhelfen kann.