Hallo
Ich mache momentan ein Projekt wo es um die Sortierung einer Tabelle geht. Die Daten werden in Arrays geladen und der entsprechende Array sortiert. Das Problem; Nur weil die Punkte korrekt sortiert werden, heist das noch lange nicht, das der entsprechende Name auch zugeordnet wird!
Code-Ausschnitt:
Alles anzeigen
Ich wollte es mit mehrdimensionalen Arrays lösen, doch da kenne ich mich nicht gut aus.
Ich mache momentan ein Projekt wo es um die Sortierung einer Tabelle geht. Die Daten werden in Arrays geladen und der entsprechende Array sortiert. Das Problem; Nur weil die Punkte korrekt sortiert werden, heist das noch lange nicht, das der entsprechende Name auch zugeordnet wird!
Code-Ausschnitt:
PHP-Quellcode
- $lines = file("content/.htfile",FILE_SKIP_EMPTY_LINES);
- $count = count($lines);
- $count = $count-1;
- $i = 0;
- while($i <= $count)
- {
- $data = explode("<|>",$lines[$i]);
- $points[] = intval($data[0]);
- $name[] = $data[1];
- $pic[] = $data[2];
- $counter[] = $data[3];
- $i++;
- }
- $X = 0;
- rsort($points);
- echo '<table border="0" width="100%">
- <tr>
- <td><h3><font color="#FF8000">PUNKTE</font></h3></td><td><h3><font color="#FF8000">FOTO</font></h3></td><td><h3><font color="#FF8000">NAME</font></h3></td><td><h3><font color="#FF8000">TOTAL BEWERTUNGEN</font></h3></td>
- </tr>';
- while($X <= $count)
- {
- echo "<tr>";
- echo '<td><b>'.strval($points[$X]).'</b></td><td><b><img src="'.$pic[$X].'" border="0" height="'.$height.'" width="'.$width.'"></b></td><td><b>'.$name[$X].'</b></td><td><b>'.$counter[$X].'</b></td>';
- echo "</tr>";
- $X++;
- }
Ich wollte es mit mehrdimensionalen Arrays lösen, doch da kenne ich mich nicht gut aus.
