SHARE
TWEET

Summary Selection

a guest Mar 9th, 2016 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function rankingSummary($lb = 0)
  2.     {
  3.         $temp = "temp_summary";
  4.         $board = "classic_summary";
  5.         if ($lb == 1) {
  6.             $board = "express_summary";
  7.         }
  8.         if ($lb != 2) {
  9.             $sql = "
  10.                 DROP TABLE IF EXISTS ".$temp.";
  11.                 CREATE TABLE ".$temp."
  12.                 (
  13.                     rank INT NOT NULL AUTO_INCREMENT,
  14.                     steamID INT NOT NULL,
  15.                     dataID INT NOT NULL,
  16.                     PRIMARY KEY (rank)
  17.                 );
  18.                 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
  19.                 INSERT INTO ".$temp." (steamID , dataID)
  20.                 SELECT a.steamID, a.id FROM player_data a RIGHT JOIN (SELECT steamID, MAX(score) max_score FROM player_data p LEFT JOIN match_data m ON p.matchID = m.matchID WHERE m.version = '".VERSION."' and m.mode = ".$lb." and cheat = 0 GROUP BY steamID) b ON a.steamID = b.steamID AND a.score = b.max_score ORDER BY score DESC;
  21.                 RENAME TABLE ".$board." TO temp, ".$temp." TO ".$board.", temp TO ".$temp.";
  22.                 COMMIT ;
  23.             ";
  24.         }
  25.         if ($lb == 2) {
  26.             $board = "frogs_summary";
  27.             $sql = "
  28.                 DROP TABLE IF EXISTS ".$temp.";
  29.                 CREATE TABLE ".$temp."
  30.                 (
  31.                     rank INT NOT NULL AUTO_INCREMENT,
  32.                     steamID INT NOT NULL,
  33.                     dataID INT NOT NULL,
  34.                     PRIMARY KEY (rank)
  35.                 );
  36.                 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
  37.                 INSERT INTO ".$temp." (steamID , dataID)
  38.                 SELECT a.steamID, a.id FROM player_data a RIGHT JOIN (SELECT steamID, MAX(icefrog_kills) max_frogs FROM player_data p LEFT JOIN match_data m ON p.matchID = m.matchID WHERE m.version = '".VERSION."' and m.mode = 0 and cheat = 0 GROUP BY steamID) b ON a.steamID = b.steamID AND a.icefrog_kills = b.max_frogs ORDER BY icefrog_kills DESC;
  39.                 RENAME TABLE ".$board." TO temp, ".$temp." TO ".$board.", temp TO ".$temp.";
  40.                 COMMIT ;
  41.             ";
  42.         }
  43.         $query = $this->db->prepare($sql);
  44.         $query->execute();
  45.     }
RAW Paste Data
Top