Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $load = $mysqli->query("SELECT * FROM matches WHERE match_fetched_player_champ = '$champ_id' OR match_player_2_champ = '$champ_id' OR match_player_3_champ = '$champ_id' OR match_player_4_champ = '$champ_id' OR match_player_5_champ = '$champ_id' OR match_player_6_champ = '$champ_id' OR match_player_7_champ = '$champ_id' OR match_player_8_champ = '$champ_id' OR match_player_9_champ = '$champ_id' OR match_player_10_champ = '$champ_id' ORDER BY match_id");
- $result = $load->fetch_all();
- $i = 0;
- $wins = 0;
- $counted = count($result);
- while($i < $counted)
- {
- if($result[$i]['4'] == $champ_id)
- {
- $champ_team = $result[$i]['5'];
- }
- elseif($result[$i]['8'] == $champ_id)
- {
- $champ_team = $result[$i]['7'];
- }
- elseif($result[$i]['11'] == $champ_id)
- {
- $champ_team = $result[$i]['10'];
- }
- elseif($result[$i]['14'] == $champ_id)
- {
- $champ_team = $result[$i]['13'];
- }
- elseif($result[$i]['17'] == $champ_id)
- {
- $champ_team = $result[$i]['16'];
- }
- elseif($result[$i]['20'] == $champ_id)
- {
- $champ_team = $result[$i]['19'];
- }
- elseif($result[$i]['23'] == $champ_id)
- {
- $champ_team = $result[$i]['22'];
- }
- elseif($result[$i]['26'] == $champ_id)
- {
- $champ_team = $result[$i]['25'];
- }
- elseif($result[$i]['29'] == $champ_id)
- {
- $champ_team = $result[$i]['28'];
- }
- elseif($result[$i]['32'] == $champ_id)
- {
- $champ_team = $result[$i]['31'];
- }
- $won_team = $result[$i]['33'];
- if($champ_team == $won_team)
- {
- $wins++;
- }
- $i++;
- }
- $faktor = $wins / count($result) * 100;
- $return = round($faktor, 1);
- $loadName = file_get_contents("http://ddragon.leagueoflegends.com/cdn/7.3.3/data/en_US/champion.json");
- $loadName = json_decode($loadName, true);
- $loadName = $loadName['data'];
- $name = $api->array_multi_search($champ_id, $loadName);
- $name = $name['0']['name'];
- echo "<h4 style='margin-left: 30px;'>Der Champion \"$name\" hat zurzeit eine Winrate von $return % ($counted gespielt - $wins gewonnen)</h4>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement