Fix SQL error when there's no condition in AccountTypeTabs
This commit is contained in:
parent
b4f7957f1c
commit
4790067527
|
@ -29,13 +29,16 @@ class AccountTypeTabs
|
||||||
|
|
||||||
public function render(string $route_name, string $current_type = '', $condition = '', $values = [], array $queryParams = []): string
|
public function render(string $route_name, string $current_type = '', $condition = '', $values = [], array $queryParams = []): string
|
||||||
{
|
{
|
||||||
|
if ($condition) {
|
||||||
|
$condition .= 'AND ' . $condition;
|
||||||
|
}
|
||||||
|
|
||||||
$stmt = 'SELECT `account_type`, COUNT(*) AS `count`
|
$stmt = 'SELECT `account_type`, COUNT(*) AS `count`
|
||||||
FROM `profile` p
|
FROM `profile` p
|
||||||
JOIN `server` s ON s.`id` = p.`server_id` AND s.`available` AND NOT s.`hidden`
|
JOIN `server` s ON s.`id` = p.`server_id` AND s.`available` AND NOT s.`hidden`
|
||||||
WHERE p.`available`
|
WHERE p.`available`
|
||||||
AND NOT p.`hidden`
|
AND NOT p.`hidden`
|
||||||
AND ' . $condition . '
|
' . $condition . '
|
||||||
GROUP BY p.`account_type`
|
GROUP BY p.`account_type`
|
||||||
ORDER BY `filled_fields` DESC, `last_activity` DESC, `updated` DESC';
|
ORDER BY `filled_fields` DESC, `last_activity` DESC, `updated` DESC';
|
||||||
$account_types = $this->connection->fetchAll($stmt, $values);
|
$account_types = $this->connection->fetchAll($stmt, $values);
|
||||||
|
|
Loading…
Reference in a new issue