Esempio n. 1
0
 function addPlayer($playername)
 {
     $playername = trim($playername);
     if (strcmp($playername, "") == 0) {
         return false;
     }
     $entry = Entry::findByEventAndPlayer($this->name, $playername);
     $added = false;
     if (is_null($entry)) {
         $player = Player::findOrCreateByName($playername);
         $db = Database::getConnection();
         $stmt = $db->prepare("INSERT INTO entries(event, player, registered_at) VALUES(?, ?, NOW())");
         $stmt->bind_param("ss", $this->name, $player->name);
         if (!$stmt->execute()) {
             print_r($stmt->error);
             return false;
         }
         $stmt->close();
         //For late registration. Check to see if event is active, if so, create entry for player in standings
         if ($this->active == 1) {
             $standing = new Standings($this->name, $playername);
             $standing->save();
         }
         $added = true;
     }
     return $added;
 }
Esempio n. 2
0
 function addPlayer($playername)
 {
     $entry = Entry::findByEventAndPlayer($this->name, $playername);
     $added = false;
     if (is_null($entry)) {
         $db = Database::getConnection();
         $stmt = $db->prepare("INSERT INTO entries(event, player) VALUES(?, ?)");
         $stmt->bind_param("ss", $this->name, $playername);
         $stmt->execute();
         $stmt->close();
         $added = true;
     }
     return $added;
 }