{source}


<?php

// Eingabe Saison
$saison="w0607";

// Erstellung der Variablen für Training und B-Faktor
$trsaison="cb_tr" . $saison;
$bfsaison="cb_bf". $saison;

// unsvar.php einbinden und pfad zu Avatar-Images festlegen
if ($_SERVER["DOCUMENT_ROOT"]=="C:/xampp/htdocs") {
include $_SERVER["DOCUMENT_ROOT"]. "/unstest/includes/unsvar.php";
$pfad = "/unstest/images/comprofiler/";
}
Else {
include $_SERVER["DOCUMENT_ROOT"]."/includes/unsvar.php";
$pfad = "/images/comprofiler/";
}

// Datenbankverbindung aufbauen
$mysqli = new mysqli($dbhost, $dbusername, $dbpassword, $dbname);
if ($mysqli -> connect_error) {
echo "Fehler bei Verbindung: " . mysqli_connect_error();
exit();
}
if (!$mysqli -> set_charset("utf8")) {
echo "Fehler beim Laden von UTF8 " . $mysqli -> error;
}
?>

<!-- Container erstellen -->
<div style="width:100%; text-align:center;">
<div style="width:auto;align:center;">
<!-- Container für Trainingsanwesenheiten -->
<div style="width:auto; float:left; margin:0 30px;">
<h3 style="text-align:center;">Trainingsanwesenheit</h3>
<table style="width:100%;margin:0 5px;">
<tr>
<th class="datenh dce">Platz</th>
<th class="datenh dle">Name</th>
<th class="datenh dce">anwesend</th>
</tr>

<!-- MYSQL Abfrage Trainingsanwesenheiten -->
<?php
$ergebnis = $mysqli -> query("SELECT
$trsaison,
(SELECT COUNT(*) FROM unsw_comprofiler AS tr1 WHERE tr2.$trsaison < tr1.$trsaison) + 1 AS trplatz,
tr2.lastname,
tr2.firstname

FROM
unsw_comprofiler AS tr2

WHERE
tr2.id != '1' AND tr2.$trsaison > '0'

ORDER BY $trsaison DESC, lastname ASC, firstname ASC");
?>

<!-- Ausgabe der Abfrage -->
<?php $i=0;

while ($ausgabe = $ergebnis -> fetch_array()) { ?>
<tr class="row_<?php echo $i % 2; ?>">
<td class="datenb dce"><?php echo $ausgabe["trplatz"] ?>.</td>
<td class="datenb dle"><?php echo $ausgabe["lastname"] ?> <?php echo $ausgabe["firstname"] ?></td>
<td class="datenb dce"><?php echo $ausgabe[$trsaison] ?></td>
</tr>
<?php $i++;
} ?>

</table>
</div>

<!-- Container für B-Faktor -->
<div style="width:auto; float:right; margin:0 30px;">
<h3 style="text-align:center;">B-Faktor</h3>
<table style="width:100%;margin:0 5px;">
<tr>
<th class="datenh dce">Platz</th>
<th class="datenh dle">Name</th>
<th class="datenh dce">Faktor</th>
</tr>

<!-- MYSQL Abfrage B-Faktor -->
<?php
$ergebnis = $mysqli -> query("SELECT
$bfsaison,
(SELECT COUNT($bfsaison) FROM unsw_comprofiler AS bf1 WHERE bf2.$bfsaison < bf1.$bfsaison) + 1 AS bplatz,
bf2.lastname,
bf2.firstname

FROM
unsw_comprofiler AS bf2

WHERE
bf2.id != '1' AND bf2.$bfsaison != '0.0'

ORDER BY $bfsaison DESC, lastname ASC, firstname ASC");

$i=0;

// Ausgabe der Abfrage
while ($ausgabe = $ergebnis -> fetch_array()) {
?>

<tr class="row_<?php echo $i % 2; ?>">
<td class="datenb dce"><?php echo $ausgabe["bplatz"] ?>.</td>
<td class="datenb dle"><?php echo $ausgabe["lastname"] ?> <?php echo $ausgabe["firstname"] ?></td>
<td class="datenb dce"><?php echo $ausgabe[$bfsaison] ?></td>
</tr>

<?php $i++;
} ?>

</table>
</div>
</div>
</div>
<div style="width:100%;height:10px;clear:both;"></div>
<div class="dfoot" style="width:100%; margin:10px;">Stand: Frühjahr 2007</div>
<div class="dfoot" style='font-size: 13px; width:100%; margin:10px;'><a href='javascript:history.back()'>Zurück</a></div>

<?php
$ergebnis -> close();
$mysqli -> close();
?>
{/source}