Skip to content

Commit

Permalink
Quote "admin" column name for MySQL (#4588)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvz committed Sep 25, 2022
1 parent 567f277 commit 0bf8fdb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion admin/modules/user/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,17 @@ function toggleBox(action)
merge_thread_ratings($source_user['uid'], $destination_user['uid']);

// Banning
$db->update_query("banned", array('admin' => $destination_user['uid']), "admin = '{$source_user['uid']}'");
switch($db->type)
{
case 'mysql':
case 'mysqli':
$where = "`admin` = '{$source_user['uid']}'";
break;
default:
$where = "admin = '{$source_user['uid']}'";
break;
}
$db->update_query("banned", array('admin' => $destination_user['uid']), $where);

// Carry over referrals
$db->update_query("users", array("referrer" => $destination_user['uid']), "referrer='{$source_user['uid']}' AND uid!='{$destination_user['uid']}'");
Expand Down
2 changes: 1 addition & 1 deletion install/resources/mysql_db_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
oldgroup int unsigned NOT NULL default '0',
oldadditionalgroups text NOT NULL,
olddisplaygroup int unsigned NOT NULL default '0',
admin int unsigned NOT NULL default '0',
`admin` int unsigned NOT NULL default '0',
dateline int unsigned NOT NULL default '0',
bantime varchar(50) NOT NULL default '',
lifted int unsigned NOT NULL default '0',
Expand Down

0 comments on commit 0bf8fdb

Please sign in to comment.