本文整理汇总了PHP中ConnectionFactory::updateTableRowRelativeBasic方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory::updateTableRowRelativeBasic方法的具体用法?PHP ConnectionFactory::updateTableRowRelativeBasic怎么用?PHP ConnectionFactory::updateTableRowRelativeBasic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionFactory
的用法示例。
在下文中一共展示了ConnectionFactory::updateTableRowRelativeBasic方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: completeMission
public function completeMission($mission)
{
$completeParams = array();
$completeParams['times_complete'] = 1;
$this->times_complete++;
$cityRank = ConnectionFactory::SelectValue("rank_avail", "users_cities", array("user_id" => $this->user_id, "city_id" => $mission->getCityID()));
switch ($cityRank) {
case 1:
$completeParams['rank_one_times'] = 1;
$this->rank_one_times++;
break;
case 2:
$completeParams['rank_two_times'] = 1;
$this->rank_two_times++;
break;
case 3:
$completeParams['rank_three_times'] = 1;
$this->rank_three_times++;
break;
}
$currRank = $this->curr_rank;
$userTimesFinishedRankForMission = $this->getRankTimes($currRank);
/*
if ($cityRank == $currRank) { //this is cause we need to incorporate changes above
$userTimesFinishedRankForMission++; //that have not hit db yet
}
*/
$missionRequirementToFinishRank = $mission->getRankReqTimes($currRank);
$unlockedMissionRank = false;
if ($userTimesFinishedRankForMission >= $missionRequirementToFinishRank) {
if ($userTimesFinishedRankForMission == $missionRequirementToFinishRank) {
if ($currRank <= 3) {
$_SESSION['justUnlockedThisMissionRank'] = $currRank + 1;
$_SESSION['justUnlockedRankMissionName'] = $mission->getName();
$unlockedMissionRank = true;
$completeParams['curr_rank'] = 1;
$this->curr_rank++;
} else {
return;
}
}
}
$cityID = $mission->getCityID();
$success = ConnectionFactory::updateTableRowRelativeBasic("users_missions", $completeParams, array("user_id" => $this->user_id, "mission_id" => $mission->getID()));
if ($unlockedMissionRank && $this->allMissionsInCityReadyForNextLevel($currRank + 1, $cityID, $this->user_id)) {
if (!ConnectionFactory::updateTableRowAbsoluteBasic("users_cities", array("rank_avail" => $currRank + 1), array("user_id" => $this->user_id, "city_id" => $cityID))) {
redirect($GLOBALS['serverRoot'] . "/errorpage.html");
}
$_SESSION['justUnlockedThisCityRank'] = $currRank + 1;
$_SESSION['justUnlockedRankMissionName'] = $mission->getName();
}
}
示例2: disableBountyAfterUser
public static function disableBountyAfterUser($targetID)
{
//$query = "UPDATE `bounties` set bounty.is_complete = 1 where target_id = ?";
$params = array();
$params['is_complete'] = 1;
$conditions = array();
$conditions['target_id'] = $targetID;
$success = ConnectionFactory::updateTableRowRelativeBasic("bounties", $params, $conditions);
if ($success) {
return $success;
}
return false;
}
示例3: updateHealthStaminaFightsExperience
public function updateHealthStaminaFightsExperience($healthAmt, $staminaAmt, $fightsWon, $fightsLost, $expAmt)
{
$params = array();
$params['health'] = $healthAmt;
$params['stamina'] = $staminaAmt;
$params['fights_won'] = $fightsWon;
$params['fights_lost'] = $fightsLost;
$params['experience'] = $expAmt;
$conditions = array();
$conditions['id'] = $this->id;
$success = ConnectionFactory::updateTableRowRelativeBasic("users", $params, $conditions);
if ($success) {
$this->health += $healthAmt;
$this->stamina += $staminaAmt;
$this->fights_won += $fightsWon;
$this->fights_lost += $fightsLost;
$this->experience += $expAmt;
}
return $success;
}
示例4: updateAchievementRank
public static function updateAchievementRank($achievementName, $id)
{
$params = array();
$conditions = array();
$params[$achievementName] = 1;
$conditions['user_id'] = $id;
$success = ConnectionFactory::updateTableRowRelativeBasic("users_achievements", $params, $conditions);
}