本文整理汇总了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;
}
示例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;
}