Advertisement
bueddl

Untitled

Sep 27th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1.  
  2.     /**
  3.      * Change Gameadmin privileagues to player with given playerId
  4.      *
  5.      * @param Int $playerId
  6.      */
  7.     public static function grant($playerId) {
  8.         $query = 'UPDATE players SET ' .
  9.                  'is_admin = 0 ' .
  10.                  'WHERE playerId IN ( ' .
  11.                  '  SELECT id ' .
  12.                  '  FROM players ' .
  13.                  '  WHERE game_id = ( ' .
  14.                  '      SELECT game_id ' .
  15.                  '      FROM players ' .
  16.                  '      WHERE id = ? ' .
  17.                  '  ) ' .
  18.                  '); ' .
  19.                  'UPDATE players SET ' .
  20.                  'is_admin = 1 ' .
  21.                  'WHERE playerId = ?;';
  22.  
  23.         return self::$db->query($query, array($playerId, $playerId))->rowCount() > 0;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement