本文整理汇总了PHP中SqlQuery::get_next_row_column方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlQuery::get_next_row_column方法的具体用法?PHP SqlQuery::get_next_row_column怎么用?PHP SqlQuery::get_next_row_column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlQuery
的用法示例。
在下文中一共展示了SqlQuery::get_next_row_column方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_todays_remaining_work_authed
/**
* Update todays date with the given work change. If todays date
* is 2011-01-23 and the remaining work size left that day is
* 10.0, and this function is called with $work_change set to 2.0,
* then after this function call the stored remaining work would
* be changed to 12.0.
*
* The user must be authenticated.
*/
public static function update_todays_remaining_work_authed($project_id, $work_change)
{
// Our dates are always UTC
$todays_date = date('Y-m-d');
$query = new SqlQuery("SELECT remaining_size FROM Remaining WHERE remaining_projectid='%s' AND remaining_date='%s' LIMIT 1", $project_id, $todays_date);
if ($query->select_was_successful()) {
// We've updated todays date before
$update_mode = 'update';
$last_size = $query->get_next_row_column('remaining_size');
} else {
// First time we update the time for this day, use size
// from yesterday (or rather, last day we made an update)
$update_mode = 'insert';
$query = new SqlQuery("SELECT remaining_size FROM Remaining WHERE remaining_projectid='%s' LIMIT 1", $project_id);
if ($query->select_was_successful()) {
$last_size = $query->get_next_row_column('remaining_size');
} else {
// First update ever for the project, start at zero
$last_size = 0.0;
}
}
$new_size = 0;
$tasks = Sql::get_tasks_from_project_id($project_id);
foreach ((array) $tasks as $task) {
$new_size += $task->get_size();
}
if ($update_mode == 'update') {
$query = new SqlQuery("UPDATE Remaining SET remaining_size='%s' WHERE remaining_projectid='%s' AND remaining_date='%s' LIMIT 1", $new_size, $project_id, $todays_date);
} else {
$query = new SqlQuery("INSERT INTO Remaining (remaining_projectid, remaining_size, remaining_date) VALUES ('%s', '%s', '%s')", $project_id, $new_size, $todays_date);
}
}