From fcff820858dca3e8d2692e9bfee27ea89c8b9727 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 7 Jul 2020 00:53:56 +0200 Subject: [PATCH] Fix #131 --- system/pages/houses.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/system/pages/houses.php b/system/pages/houses.php index 954ef789..db1a6992 100644 --- a/system/pages/houses.php +++ b/system/pages/houses.php @@ -143,8 +143,20 @@ if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order']) && if($type == 'guildhalls' && !$db->hasColumn('houses', 'guild')) $type = 'all'; - if(!empty($type) && $type != 'all') - $whereby .= ' AND `guild` ' . ($type == 'guildhalls' ? '!' : '') . '= 0'; + if (!empty($type) && $type != 'all') + { + $guildColumn = ''; + if ($db->hasColumn('houses', 'guild')) { + $guildColumn = 'guild'; + } + else if ($db->hasColumn('houses', 'guildid')) { + $guildColumn = 'guildid'; + } + + if($guildColumn !== '') { + $whereby .= ' AND `' . $guildColumn . '` ' . ($type == 'guildhalls' ? '!' : '') . '= 0'; + } + } $houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby);