Ich habe dieses PHP-Skript, das nur einen Benutzer pro p
zeigen sollte. account_id
, funktioniert aber nicht so.Wählen Sie nur einen Benutzer pro Konto
Wenn der Benutzer zwei andere Benutzer im selben Konto hat, wird dies ebenfalls angezeigt. Ich konnte mir nichts vorstellen, um das zu beheben.
$groupConfig = [
'Administrator' => ['groupId' => 5, 'accountType' => [5]],
'Community Manager' => ['groupId' => 4, 'accountType' => [4]],
'Gamemaster' => ['groupId' => 3, 'accountType' => [4]],
'Tutor' => ['groupId' => 1, 'accountType' => [2, 3]],
];
foreach ($groupConfig as $groupTitle => $group) {
$k = $SQL->query('SELECT
`p`.`name`,
`p`.`lastlogin`,
`p`.`id`,
`p`.`group_id`,
`a`.`type`
FROM
`players` AS `p`
LEFT JOIN `accounts` AS `a`
ON `a`.`id` = `p`.`account_id`
WHERE `a`.`type`
IN (' . implode(',', $group['accountType']) . ')
AND group_id = ' . $group['groupId'] . '
ORDER BY
`group_id`
DESC')->fetchAll();
}