Замена mysql_query и упрощение.
This commit is contained in:
@@ -199,6 +199,28 @@ insert into eff_users
|
||||
Db::sql("insert into eff_users (no_Ace, id_eff, overType, uid, name, data, timeUse) values (1,479,112,?,'Защита от нападения','zashitatk=1',unix_timestamp())", [$userId]);
|
||||
}
|
||||
|
||||
public static function setHod(int $id, int $hod, int|string $x = 0, string $data = ''): void
|
||||
{
|
||||
$args = ['id' => $id, 'hod' => $hod];
|
||||
$xsql = '';
|
||||
$datasql = '';
|
||||
|
||||
if ($x === 'x + 1') {
|
||||
$xsql = ', x = x + 1';
|
||||
} elseif (is_numeric($x)) {
|
||||
$xsql = ', x = :x';
|
||||
$args['x'] = $x;
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$datasql = ', data = :data';
|
||||
$args['data'] = $data;
|
||||
}
|
||||
|
||||
$sql = "update eff_users set hod = :hod$xsql$datasql where id = :id";
|
||||
Db::sql($sql, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Духовность. Спасение.
|
||||
* Из свитка нападения.
|
||||
|
||||
Reference in New Issue
Block a user