<html>
<head>
<title>Rangliste Foros</title>
<link rel="stylesheet" type="text/css" href="layout.css">
</head>
<body>

<?php


$DBName="DB127817";
$TabelName="Fragen";

$Link=mysql_connect("rdbms.strato.de","U127817","ZH67uH95");


$Query="Select Mitspieler,sum(Punkte) as Punkte from TippspielEM group by Mitspieler";
$Result=mysql_db_query("DB127817",$Query,$Link);

print("<div class=text>Gesamtstand nach 7 Spieltagen</div><br>");

while($Row=mysql_fetch_array($Result))
{
$Gesamt[] = array('Mitspieler' => $Row[Mitspieler], 'Punkte' => $Row[Punkte]);
       }

foreach ($Gesamt as $key => $row) {
    $Punkte[$key]  = $row['Punkte'];
    $Mitspieler[$key] = $row['Mitspieler'];
}
array_multisort($Punkte, SORT_DESC, $Mitspieler, SORT_ASC, $Gesamt);

echo "<table>";
foreach($Gesamt as $Ausgabe)
  echo "<tr><td width=25pxl><div class=text>",$Ausgabe['Punkte'],"</td>","<td><div class=text>",$Ausgabe['Mitspieler'],"</td></tr>";
echo "</table>";


$QueryT="Select Mitspieler,sum(Punkte) as Punkte from TippspielEM where Spieltag=7 group by Mitspieler";
$ResultT=mysql_db_query("DB127817",$QueryT,$Link);

print("<div class=text><br><br>Tageswertung 7. Spieltag</div><br>");

while($Row=mysql_fetch_array($ResultT))
{
$GesamtT[] = array('MitspielerT' => $Row[Mitspieler], 'PunkteT' => $Row[Punkte]);
       }

foreach ($GesamtT as $keyT => $rowT) {
    $PunkteT[$keyT]  = $rowT['PunkteT'];
    $MitspielerT[$keyT] = $rowT['MitspielerT'];
}
array_multisort($PunkteT, SORT_DESC, $MitspielerT, SORT_ASC, $GesamtT);

echo "<table>";
foreach($GesamtT as $Ausgabe)
  echo "<tr><td width=25pxl><div class=text>",$Ausgabe['PunkteT'],"</td>","<td><div class=text>",$Ausgabe['MitspielerT'],"</td></tr>";
echo "</table>";

  mysql_close($Link);
?>

</body>
</html>