当前位置: 首页>>代码示例>>PHP>>正文


PHP Entry::findByEventAndPlayer方法代码示例

本文整理汇总了PHP中Entry::findByEventAndPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::findByEventAndPlayer方法的具体用法?PHP Entry::findByEventAndPlayer怎么用?PHP Entry::findByEventAndPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entry的用法示例。


在下文中一共展示了Entry::findByEventAndPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPlayer

 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;
 }
开发者ID:jamuraa,项目名称:gatherling,代码行数:27,代码来源:Event.php

示例2: addPlayer

 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;
 }
开发者ID:OldVig,项目名称:gatherling,代码行数:14,代码来源:Event.php


注:本文中的Entry::findByEventAndPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。