Fix delete character exception

This commit is contained in:
slawkens 2024-02-16 20:27:48 +01:00
parent 647eae08b4
commit 9f3231fff6

View File

@ -61,16 +61,18 @@ if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
} }
} }
if(empty($errors)) {
$ownerid = 'ownerid'; $ownerid = 'ownerid';
if($db->hasColumn('guilds', 'owner_id')) if ($db->hasColumn('guilds', 'owner_id'))
$ownerid = 'owner_id'; $ownerid = 'owner_id';
$guild = $db->query('SELECT `name` FROM `guilds` WHERE `' . $ownerid . '` = '.$player->getId()); $guild = $db->query('SELECT `name` FROM `guilds` WHERE `' . $ownerid . '` = ' . $player->getId());
if($guild->rowCount() > 0) { if ($guild->rowCount() > 0) {
$errors[] = 'You cannot delete a character when they own a guild.'; $errors[] = 'You cannot delete a character when they own a guild.';
} }
}
if(empty($errors)) { if(empty($errors)) {
//dont show table "delete character" again // don't show table "delete character" again
$show_form = false; $show_form = false;
/** @var OTS_DB_MySQL $db */ /** @var OTS_DB_MySQL $db */
if ($db->hasColumn('players', 'deletion')) if ($db->hasColumn('players', 'deletion'))