172 lines
5.7 KiB
PHP
172 lines
5.7 KiB
PHP
|
|
<?
|
|
|
|
$year = date("Y");
|
|
$sql = "SELECT ID, NAME, LENGTH, CLIMB from RACES where YEAR like '".$year."'";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$table_registered = '';
|
|
while($row = $result->fetch_assoc()) {
|
|
$races[] = $row;
|
|
}
|
|
}
|
|
foreach($races as $race){
|
|
$race_blob[$race['ID']] = $race['NAME'];
|
|
}
|
|
|
|
$sql = "SELECT ID, NICK, RACE, TIME FROM REGISTERED";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$reg_racers = [];
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$reg_racers[$row["RACE"]][] = ["ID" => $row["ID"], "NICK" => $row["NICK"], "RACE" => $race_blob[$row["RACE"]], "TIME" => $row["TIME"]];
|
|
}
|
|
}else{
|
|
//echo "0 results";
|
|
}
|
|
|
|
$sql = "SELECT ID, NICK, RACE, TIME FROM REGISTERED where RACE like '5' order by TIME ASC";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$reg_racers = [];
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$reg_racers_5[] = ["ID" => $row["ID"], "NICK" => $row["NICK"], "RACE" => $race_blob[$row["RACE"]], "TIME" => $row["TIME"]];
|
|
}
|
|
}else{
|
|
$reg_racers_5 = null;
|
|
}
|
|
|
|
$sql = "SELECT ID, NICK, RACE, TIME FROM REGISTERED where RACE like '4' order by TIME ASC";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$reg_racers = [];
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$reg_racers_4[] = ["ID" => $row["ID"], "NICK" => $row["NICK"], "RACE" => $race_blob[$row["RACE"]], "TIME" => $row["TIME"]];
|
|
}
|
|
}else{
|
|
$reg_racers_4 = null;
|
|
}
|
|
|
|
$sql = "SELECT ID, NICK, RACE, TIME FROM REGISTERED where RACE like '3' order by TIME ASC";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$reg_racers = [];
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$reg_racers_3[] = ["ID" => $row["ID"], "NICK" => $row["NICK"], "RACE" => $race_blob[$row["RACE"]], "TIME" => $row["TIME"]];
|
|
}
|
|
}else{
|
|
$reg_racers_3 = null;
|
|
}
|
|
|
|
$sql = "SELECT ID, NICK, RACE, TIME FROM REGISTERED where RACE like '2' order by TIME ASC";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$reg_racers = [];
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$reg_racers_2[] = ["ID" => $row["ID"], "NICK" => $row["NICK"], "RACE" => $race_blob[$row["RACE"]], "TIME" => $row["TIME"]];
|
|
}
|
|
}else{
|
|
$reg_racers_2 = null;
|
|
}
|
|
|
|
$sql = "SELECT ID, NICK, RACE, TIME FROM REGISTERED where RACE like '1' order by TIME ASC";
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0){
|
|
$reg_racers = [];
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
$reg_racers_1[] = ["ID" => $row["ID"], "NICK" => $row["NICK"], "RACE" => $race_blob[$row["RACE"]], "TIME" => $row["TIME"]];
|
|
}
|
|
}else{
|
|
$reg_racers_1 = null;
|
|
}
|
|
|
|
if($reg_racers_5 != null){
|
|
$place = 1;
|
|
$medal = '';
|
|
$reg_race_5_display = '';
|
|
foreach($reg_racers_5 as $racer){
|
|
if($place == 1) $medal = '<img src="./img/1st.jpg" class="w3-image" width="20">';
|
|
if($place == 2) $medal = '<img src="./img/2nd.jpg" class="w3-image" width="20">';
|
|
if($place == 3) $medal = '<img src="./img/3rd.jpg" class="w3-image" width="20">';
|
|
$reg_race_5_display = $reg_race_5_display.'<tr><td>'.$racer['ID'].'</td><td>'.$racer["NICK"].'</td><td>'.$racer["RACE"].'</td><td>'.$racer["TIME"].'</td><td>'.$place.'. '.$medal.'</td></tr>';
|
|
$place++;
|
|
$medal = '';
|
|
}
|
|
}
|
|
else {
|
|
$reg_race_5_display = '';
|
|
}
|
|
if($reg_racers_4 != null){
|
|
$place = 1;
|
|
$medal = '';
|
|
$reg_race_4_display = '';
|
|
foreach($reg_racers_4 as $racer){
|
|
if($place == 1) $medal = '<img src="./img/1st.jpg" class="w3-image" width="20">';
|
|
if($place == 2) $medal = '<img src="./img/2nd.jpg" class="w3-image" width="20">';
|
|
if($place == 3) $medal = '<img src="./img/3rd.jpg" class="w3-image" width="20">';
|
|
$reg_race_4_display = $reg_race_4_display.'<tr><td>'.$racer['ID'].'</td><td>'.$racer["NICK"].'</td><td>'.$racer["TIME"].'</td><td>'.$place.'. '.$medal.'</td></tr>';
|
|
$place++;
|
|
$medal = '';
|
|
}
|
|
}
|
|
else {
|
|
$reg_race_4_display = '';
|
|
}
|
|
if($reg_racers_3 != null){
|
|
$place = 1;
|
|
$medal = '';
|
|
$reg_race_3_display = '';
|
|
foreach($reg_racers_3 as $racer){
|
|
if($place == 1) $medal = '<img src="./img/1st.jpg" class="w3-image" width="20">';
|
|
if($place == 2) $medal = '<img src="./img/2nd.jpg" class="w3-image" width="20">';
|
|
if($place == 3) $medal = '<img src="./img/3rd.jpg" class="w3-image" width="20">';
|
|
$reg_race_3_display = $reg_race_3_display.'<tr><td>'.$racer['ID'].'</td><td>'.$racer["NICK"].'</td><td>'.$racer["TIME"].'</td><td>'.$place.'. '.$medal.'</td></tr>';
|
|
$place++;
|
|
$medal = '';
|
|
}
|
|
}
|
|
else {
|
|
$reg_race_3_display = '';
|
|
}
|
|
if($reg_racers_2 != null){
|
|
$place = 1;
|
|
$medal = '';
|
|
$reg_race_2_display = '';
|
|
foreach($reg_racers_2 as $racer){
|
|
if($place == 1) $medal = '<img src="./img/1st.jpg" class="w3-image" width="20">';
|
|
if($place == 2) $medal = '<img src="./img/2nd.jpg" class="w3-image" width="20">';
|
|
if($place == 3) $medal = '<img src="./img/3rd.jpg" class="w3-image" width="20">';
|
|
$reg_race_2_display = $reg_race_2_display.'<tr><td>'.$racer['ID'].'</td><td>'.$racer["NICK"].'</td><td>'.$racer["TIME"].'</td><td>'.$place.'. '.$medal.'</td></tr>';
|
|
$place++;
|
|
$medal = '';
|
|
}
|
|
}
|
|
else {
|
|
$reg_race_2_display = '';
|
|
}
|
|
if($reg_racers_1 != null){
|
|
$place = 1;
|
|
$medal = '';
|
|
$reg_race_1_display = '';
|
|
foreach($reg_racers_1 as $racer){
|
|
if($place == 1) $medal = '<img src="./img/1st.jpg" class="w3-image" width="20">';
|
|
if($place == 2) $medal = '<img src="./img/2nd.jpg" class="w3-image" width="20">';
|
|
if($place == 3) $medal = '<img src="./img/3rd.jpg" class="w3-image" width="20">';
|
|
$reg_race_1_display = $reg_race_1_display.'<tr><td>'.$racer['ID'].'</td><td>'.$racer["NICK"].'</td><td>'.$racer["TIME"].'</td><td>'.$place.'. '.$medal.'</td></tr>';
|
|
$place++;
|
|
$medal = '';
|
|
}
|
|
}
|
|
else {
|
|
$reg_race_1_display = '';
|
|
}
|
|
?>
|
|
|
|
|