Beispiel #1
0
function upd_db_unit_by_location($user_id = 0, $location_type, $location_id, $unit_snid = 0, $for_update = false, $fields = '*')
{
    return db_fetch(upd_do_query("SELECT {$fields}\n    FROM {{unit}}\n    WHERE\n      `unit_location_type` = {$location_type} AND `unit_location_id` = {$location_id} AND " . db_unit_time_restrictions() . ($user_id = intval($user_id) ? " AND `unit_player_id` = {$user_id}" : '') . ($unit_snid = intval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : '') . " LIMIT 1" . ($for_update ? ' FOR UPDATE' : '')));
}
Beispiel #2
0
function db_unit_list_stat_calculate()
{
    return doquery("SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount\n    FROM `{{unit}}`\n    WHERE unit_level > 0 AND " . db_unit_time_restrictions() . " GROUP BY unit_player_id, unit_type, unit_snid, unit_level");
}