I have created a database which contains people from a run with the amount of rounds which they ran. After that I created this script which creates a html chart.
The script:
<?php
$db = new PDO("mysql:host=HIDDEN;dbname=HIDDEN", 'HIDDEN', 'HIDDEN') or die ("Verbindung nicht möglich");
$query_temp = $db->prepare("SELECT * FROM runners");
$query_temp->bindParam(':id', $id);
$id = 1;
$query_temp->execute();
echo '<table class="table table-hover">';
echo '<tr>';
echo '<th>ID</th>';
echo '<th>Name</th>';
echo '<th>Runden</th>';
echo '</tr>';
while($id_table = $query_temp->fetch(PDO::FETCH_ASSOC)) {
echo '<tr>';
echo '<td>'.$id_table['runner_id'].'</td>';
echo '<td>'.$id_table['runner_name'].'</td>';
echo '<td>'.$id_table['runner_rounds'].'</td>';
echo '</tr>';
}
echo '</table>';
?>
The Database: http://img.prntscr.com/img?url=http://i.imgur.com/WklMcTG.png
Screenshot how it looks: http://img.prntscr.com/img?url=http://i.imgur.com/v2zbOSu.png
Now I want to give the users the ability to sort the people for their amount of rounds which they ran. Like the most person is at the first place. How can I do this?