Advertisement
bueddl

Untitled

Sep 26th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1.     public static function create() {
  2.         do {
  3.  
  4.             $code = Game::randStr();
  5.  
  6.             $query = 'INSERT IGNORE INTO games (code, player_count, valid_from, valid_to) VALUES (?, 2, DATE_ADD(CURDATE(), INTERVAL 8 HOUR), DATE_ADD(CURDATE(), INTERVAL 20 HOUR));';
  7.  
  8.             $pstmt = self::$db->query($query, array($code));
  9.  
  10.         } while ($pstmt->rowCount() == 0);
  11.  
  12.         return $pstmt->lastInsertId();
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement