Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.49 KB | None | 0 0
  1.         $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");
  2.         $result = $load->fetch_all();
  3.  
  4.         $i = 0;
  5.         $wins = 0;
  6.  
  7.         $counted = count($result);
  8.  
  9.         while($i < $counted)
  10.         {
  11.           if($result[$i]['4'] == $champ_id)
  12.           {
  13.             $champ_team = $result[$i]['5'];
  14.           }
  15.           elseif($result[$i]['8'] == $champ_id)
  16.           {
  17.             $champ_team = $result[$i]['7'];
  18.           }
  19.           elseif($result[$i]['11'] == $champ_id)
  20.           {
  21.             $champ_team = $result[$i]['10'];
  22.           }
  23.           elseif($result[$i]['14'] == $champ_id)
  24.           {
  25.             $champ_team = $result[$i]['13'];
  26.           }
  27.           elseif($result[$i]['17'] == $champ_id)
  28.           {
  29.             $champ_team = $result[$i]['16'];
  30.           }
  31.           elseif($result[$i]['20'] == $champ_id)
  32.           {
  33.             $champ_team = $result[$i]['19'];
  34.           }
  35.           elseif($result[$i]['23'] == $champ_id)
  36.           {
  37.             $champ_team = $result[$i]['22'];
  38.           }
  39.           elseif($result[$i]['26'] == $champ_id)
  40.           {
  41.             $champ_team = $result[$i]['25'];
  42.           }
  43.           elseif($result[$i]['29'] == $champ_id)
  44.           {
  45.             $champ_team = $result[$i]['28'];
  46.           }
  47.           elseif($result[$i]['32'] == $champ_id)
  48.           {
  49.             $champ_team = $result[$i]['31'];
  50.           }
  51.  
  52.           $won_team = $result[$i]['33'];
  53.  
  54.           if($champ_team == $won_team)
  55.           {
  56.             $wins++;
  57.           }
  58.  
  59.           $i++;
  60.         }
  61.  
  62.         $faktor = $wins / count($result) * 100;
  63.         $return = round($faktor, 1);
  64.  
  65.         $loadName = file_get_contents("http://ddragon.leagueoflegends.com/cdn/7.3.3/data/en_US/champion.json");
  66.         $loadName = json_decode($loadName, true);
  67.         $loadName = $loadName['data'];
  68.  
  69.         $name = $api->array_multi_search($champ_id, $loadName);
  70.         $name = $name['0']['name'];
  71.         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