query("SELECT * FROM evf_game_data WHERE game_id=".$_GET["id"]." ORDER BY team_id");
if ($db->rows() > 0) {
$temp = $db->next();
//-----------------
$db2->query("SELECT * FROM evf_games ORDER BY no");
$jrk = 0;
while ($temp2 = $db2->next()) {
$theorder[$jrk] = $temp2->id;
if ($temp2->id == $_GET["id"]) $oluline = $jrk;
$jrk++;
}
if ($oluline > 0) $previous_game = "Previous game";
else $previous_game = "Previous game";
if ($oluline < (sizeof($theorder) - 1)) $next_game = "Next game";
else $next_game = "Next game";
//-----------------
$db2->query("SELECT * FROM evf_games WHERE id=".$temp->game_id);
$temp2 = $db2->next();
$sets[1] = $sets[2] = 0;
if ($temp2->t1_set1 > $temp2->t2_set1) $sets[1]++; elseif ($temp2->t1_set1 < $temp2->t2_set1) $sets[2]++;
if ($temp2->t1_set2 > $temp2->t2_set2) $sets[1]++; elseif ($temp2->t1_set2 < $temp2->t2_set2)$sets[2]++;
if ($temp2->t1_set3 > $temp2->t2_set3) $sets[1]++; elseif ($temp2->t1_set3 < $temp2->t2_set3)$sets[2]++;
if ($temp2->t1_set4 > $temp2->t2_set4) $sets[1]++; elseif ($temp2->t1_set4 < $temp2->t2_set4)$sets[2]++;
if ($temp2->t1_set5 > $temp2->t2_set5) $sets[1]++; elseif ($temp2->t1_set5 < $temp2->t2_set5)$sets[2]++;
if ($sets[1] > $sets[2]) $temp2->team1 = "".$temp->team1.""; else $temp->team2 = "".$temp->team2."";
if ($temp2->t1_set1 > 0 && $temp2->t2_set1 > 0) $set1 = $temp2->t1_set1."/".$temp2->t2_set1; else $set1 = "";
if ($temp2->t1_set2 > 0 && $temp2->t2_set2 > 0) $set2 = $temp2->t1_set2."/".$temp2->t2_set2; else $set2 = "";
if ($temp2->t1_set3 > 0 && $temp2->t2_set3 > 0) $set3 = $temp2->t1_set3."/".$temp2->t2_set3; else $set3 = "";
if ($temp2->t1_set4 > 0 && $temp2->t2_set4 > 0) $set4 = $temp2->t1_set4."/".$temp2->t2_set4; else $set4 = "";
if ($temp2->t1_set5 > 0 && $temp2->t2_set5 > 0) $set5 = $temp2->t1_set5."/".$temp2->t2_set5; else $set5 = "";
echo " ".$temp2->no.". ".$temp2->name." (".implode(".", array_reverse(explode("-", $temp2->date2))).", ".$temp2->place.") ";
echo $sets[1].":".$sets[2]." (".(strlen($set1) > 2 ? $set1 : "").(strlen($set2) > 2 ? ", ".$set2 : "").(strlen($set3) > 2 ? ", ".$set3 : "").(strlen($set4) > 2 ? ", ".$set4 : "").(strlen($set5) > 2 ? ", ".$set5 : "").") ";
echo "".$previous_game." | ".$next_game." ";
echo "
About table...
Reception: 1 - excellent, 2 - good, 3 - poor, 4 - error, P - success %, M - error %
Attack: 1 - point, 2 - ball in game, 3 - error, P - success %, M - error %
Serve: 1 - ace, 2 - good, 3 - poor, 4 - error, P - success %, M - error %
Block: 1 - point, 2 - ball in game
W-L - won/lost points difference
";
$db->query("SELECT * FROM evf_game_data WHERE game_id=".$_GET["id"]." ORDER BY team_id");
echo "";
while ($temp = $db->next()) {
$db2->query("SELECT * FROM evf_players WHERE id=".$temp->player_id." ORDER BY no");
$temp2 = $db2->next();
if ($praegune_team != $temp->team_id) {
$n++; //algväärtus oli 1
if ($n == 3) {
$db3->query("SELECT sum(rec_1) as rec_1, sum(rec_2) as rec_2, sum(rec_3) as rec_3, sum(rec_4) as rec_4, sum(att_1) as att_1, sum(att_2) as att_2, sum(att_3) as att_3, sum(serve_1) as serve_1, sum(serve_2) as serve_2, sum(serve_3) as serve_3, sum(serve_4) as serve_4, sum(block_1) as block_1, sum(block_2) as block_2 FROM evf_game_data WHERE game_id=".$_GET["id"]." AND team_id=".$praegune_team);
$temp3 = $db3->next();
echo "Team: | ".$temp3->rec_1." | ".$temp3->rec_2." | ".$temp3->rec_3." | ".$temp3->rec_4." | ".round(($temp3->rec_1 + $temp3->rec_2)/($temp3->rec_1 + $temp3->rec_2 + $temp3->rec_3 + $temp3->rec_4 + 0.00001) * 100, 1)." | ".round($temp3->rec_4/($temp3->rec_1 + $temp3->rec_2 + $temp3->rec_3 + $temp3->rec_4 + 0.00001) * 100, 1)." | ".$temp3->att_1." | ".$temp3->att_2." | ".$temp3->att_3." | ".round($temp3->att_1/($temp3->att_1 + $temp3->att_2 + $temp3->att_3 + 0.00001) * 100, 1)." | ".round($temp3->att_3/($temp3->att_1 + $temp3->att_2 + $temp3->att_3 + 0.00001) * 100, 1)." | ".$temp3->serve_1." | ".$temp3->serve_2." | ".$temp3->serve_3." | ".$temp3->serve_4." | ".round(100*($temp3->serve_1 + $temp3->serve_2)/($temp3->serve_1 + $temp3->serve_2 + $temp3->serve_3 + $temp3->serve_4+ 0.00001), 1)." | ".round(100*$temp3->serve_4/($temp3->serve_1 + $temp3->serve_2 + $temp3->serve_3 + $temp3->serve_4+ 0.00001), 1)." | ".$temp3->block_1." | ".$temp3->block_2." | ".($temp3->att_1 + $temp3->serve_1 + $temp3->block_1 - $temp3->rec_4 - $temp3->att_3 - $temp3->serve_4)." | \n";
}
$db3->query("SELECT team_name FROM evf_teams WHERE id=".$temp2->team_id);
$temp3 = $db3->next();
echo "".$temp3->team_name." | \n";
echo "No. | Name | Reception | Attack | Serve | Block | W-L | \n";
echo "1 | 2 | 3 | 4 | P | M | 1 | 2 | 3 | P | M | 1 | 2 | 3 | 4 | P | M | 1 | 2 | \n";
$praegune_team = $temp->team_id;
}
echo "id.">".$temp2->no." | id.">".$temp2->first_name." ".$temp2->last_name." | ".$temp->rec_1." | ".$temp->rec_2." | ".$temp->rec_3." | ".$temp->rec_4." | ".round(($temp->rec_1 + $temp->rec_2)/($temp->rec_1 + $temp->rec_2 + $temp->rec_3 + $temp->rec_4 + 0.00001) * 100, 1)." | ".round($temp->rec_4/($temp->rec_1 + $temp->rec_2 + $temp->rec_3 + $temp->rec_4 + 0.00001) * 100, 1)." | ".$temp->att_1." | ".$temp->att_2." | ".$temp->att_3." | ".round($temp->att_1/($temp->att_1 + $temp->att_2 + $temp->att_3 + 0.00001) * 100, 1)." | ".round($temp->att_3/($temp->att_1 + $temp->att_2 + $temp->att_3 + 0.00001) * 100, 1)." | ".$temp->serve_1." | ".$temp->serve_2." | ".$temp->serve_3." | ".$temp->serve_4." | ".round(100*($temp->serve_1 + $temp->serve_2)/($temp->serve_1 + $temp->serve_2 + $temp->serve_3 + $temp->serve_4+ 0.00001), 1)." | ".round(100*$temp->serve_4/($temp->serve_1 + $temp->serve_2 + $temp->serve_3 + $temp->serve_4+ 0.00001), 1)." | ".$temp->block_1." | ".$temp->block_2." | ".($temp->att_1 + $temp->serve_1 + $temp->block_1 - $temp->rec_4 - $temp->att_3 - $temp->serve_4)." | \n";
}
$db3->query("SELECT sum(rec_1) as rec_1, sum(rec_2) as rec_2, sum(rec_3) as rec_3, sum(rec_4) as rec_4, sum(att_1) as att_1, sum(att_2) as att_2, sum(att_3) as att_3, sum(serve_1) as serve_1, sum(serve_2) as serve_2, sum(serve_3) as serve_3, sum(serve_4) as serve_4, sum(block_1) as block_1, sum(block_2) as block_2 FROM evf_game_data WHERE game_id=".$_GET["id"]." AND team_id=".$praegune_team);
$temp3 = $db3->next();
echo "Team: | ".$temp3->rec_1." | ".$temp3->rec_2." | ".$temp3->rec_3." | ".$temp3->rec_4." | ".round(($temp3->rec_1 + $temp3->rec_2)/($temp3->rec_1 + $temp3->rec_2 + $temp3->rec_3 + $temp3->rec_4 + 0.00001) * 100, 1)." | ".round($temp3->rec_4/($temp3->rec_1 + $temp3->rec_2 + $temp3->rec_3 + $temp3->rec_4 + 0.00001) * 100, 1)." | ".$temp3->att_1." | ".$temp3->att_2." | ".$temp3->att_3." | ".round($temp3->att_1/($temp3->att_1 + $temp3->att_2 + $temp3->att_3 + 0.00001) * 100, 1)." | ".round($temp3->att_3/($temp3->att_1 + $temp3->att_2 + $temp3->att_3 + 0.00001) * 100, 1)." | ".$temp3->serve_1." | ".$temp3->serve_2." | ".$temp3->serve_3." | ".$temp3->serve_4." | ".round(100*($temp3->serve_1 + $temp3->serve_2)/($temp3->serve_1 + $temp3->serve_2 + $temp3->serve_3 + $temp3->serve_4+ 0.00001), 1)." | ".round(100*$temp3->serve_4/($temp3->serve_1 + $temp3->serve_2 + $temp3->serve_3 + $temp3->serve_4+ 0.00001), 1)." | ".$temp3->block_1." | ".$temp3->block_2." | ".($temp3->att_1 + $temp3->serve_1 + $temp3->block_1 - $temp3->rec_4 - $temp3->att_3 - $temp3->serve_4)." | \n";
echo " ";
}
$body = ob_get_contents();
ob_end_clean();
echo($body);
} else {
ob_start();
$n = 1;
echo "Schenker League 2009/2010 Season: GAMES STATISTICS SUMMARY ";
echo "";
echo "No. | Date | Place | Team 1 | Team 2 | Result | Set 1 | Set 2 | Set 3 | Set 4 | Set 5 | \n";
$db->query("SELECT * FROM evf_games ORDER BY no DESC");
while ($temp = $db->next()) {
$sets[1] = $sets[2] = 0;
if ($temp->t1_set1 > $temp->t2_set1) $sets[1]++; elseif ($temp->t1_set1 < $temp->t2_set1) $sets[2]++;
if ($temp->t1_set2 > $temp->t2_set2) $sets[1]++; elseif ($temp->t1_set2 < $temp->t2_set2)$sets[2]++;
if ($temp->t1_set3 > $temp->t2_set3) $sets[1]++; elseif ($temp->t1_set3 < $temp->t2_set3)$sets[2]++;
if ($temp->t1_set4 > $temp->t2_set4) $sets[1]++; elseif ($temp->t1_set4 < $temp->t2_set4)$sets[2]++;
if ($temp->t1_set5 > $temp->t2_set5) $sets[1]++; elseif ($temp->t1_set5 < $temp->t2_set5)$sets[2]++;
if ($sets[1] > $sets[2]) $temp->team1 = "".$temp->team1.""; else $temp->team2 = "".$temp->team2."";
if ($temp->t1_set1 > 0 && $temp->t2_set1 > 0) $set1 = $temp->t1_set1."/".$temp->t2_set1; else $set1 = "";
if ($temp->t1_set2 > 0 && $temp->t2_set2 > 0) $set2 = $temp->t1_set2."/".$temp->t2_set2; else $set2 = "";
if ($temp->t1_set3 > 0 && $temp->t2_set3 > 0) $set3 = $temp->t1_set3."/".$temp->t2_set3; else $set3 = "";
if ($temp->t1_set4 > 0 && $temp->t2_set4 > 0) $set4 = $temp->t1_set4."/".$temp->t2_set4; else $set4 = "";
if ($temp->t1_set5 > 0 && $temp->t2_set5 > 0) $set5 = $temp->t1_set5."/".$temp->t2_set5; else $set5 = "";
echo "id.">".$temp->no." | ".implode(".", array_reverse(explode("-", $temp->date2)))." | ".$temp->place." | ".$temp->team1." | ".$temp->team2." | ".$sets[1].":".$sets[2]." | ".$set1." | ".$set2." | ".$set3." | ".$set4." | ".$set5." | \n";
}
echo " ";
$body = ob_get_contents();
ob_end_clean();
echo($body);
}
?>
|