Logo

zurück

info("clicked showAllUsersTipps.php5"); printGroupMatches(); function getUserInfo($username){ $tableusers=dbschema::users; $sql="SELECT * from $tableusers WHERE username='$username'"; $resultUser=mysql_query($sql); $array=mysql_fetch_array($resultUser); $firstname=$array["firstname"]; $lastname=$array["lastname"]; return "$firstname $lastname"; } function printGroupMatches(){ echo "

Gruppenspiel-Tipps

"; echo "
"; $table_matches=dbschema::matches; $sql="SELECT * FROM $table_matches m WHERE m.matchtype='Gruppenspiel'"; $sqlResult=mysql_query($sql); echo ""; echo ""; echo " "; while($array=mysql_fetch_array($sqlResult)){ $matchnr = $array["matchnr"]; //echo ""; echo ""; } echo ""; echo ""; echo ""; $sqlResult=mysql_query($sql); while($array=mysql_fetch_array($sqlResult)){ $teamName1=$array["team1"]; $teamName2=$array["team2"]; //echo ""; echo ""; } echo ""; $table_users=dbschema::users; $sql="SELECT * FROM $table_users t where username!='admin' ORDER BY lastname,firstname"; $sqlResult=mysql_query($sql); while($array=mysql_fetch_array($sqlResult)){ echo ""; printGroupMatchesForUser($array["username"]); echo ""; } echo "
Spiel $matchnr $matchnr
Paarung $teamName1 - $teamName2$teamName1-$teamName2
"; } function printGroupMatchesForUser($username){ $table_matches=dbschema::matches; $table_users=dbschema::users; $table_tipps=dbschema::groupmatchtipps; echo ""; echo "" . getUserInfo($username) . ""; $sql="SELECT * FROM $table_matches m LEFT JOIN $table_tipps gmt ON m.matchnr=gmt.matchnr AND gmt.user='$username' WHERE m.matchtype='Gruppenspiel' "; $sqlResult=mysql_query($sql); while($array=mysql_fetch_array($sqlResult)){ $matchnr=$array["matchnr"]; $tippGoalsTeam1=$array["goalsX"]; $tippGoalsTeam2=$array["goalsY"]; $evaluationDone=$array["evaluationDone"]; if($evaluationDone === "T"){ // get points $points = $array["score"]; if($points == NULL){ // should not happen when evaluation is already done, but use default then echo "$tippGoalsTeam1 : $tippGoalsTeam2"; } else if($points == 0){ // print white echo "
$tippGoalsTeam1 : $tippGoalsTeam2
"; } else if($points == 2){ // print light blue echo "
$tippGoalsTeam1 : $tippGoalsTeam2
"; } else if($points == 4){ // print light green echo "
$tippGoalsTeam1 : $tippGoalsTeam2
"; } } else { //echo "$tippGoalsTeam1 : $tippGoalsTeam2"; echo "$tippGoalsTeam1 : $tippGoalsTeam2"; } } echo ""; } ?>