Замена mysql_query и упрощение.

This commit is contained in:
2024-02-10 18:18:11 +02:00
parent 98882e156e
commit 8c49088f27
3 changed files with 90 additions and 97 deletions
+22
View File
@@ -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);
}
/**
* Духовность. Спасение.
* Из свитка нападения.