0 and banned = 0 and bot = 0 order by id desc'); $tbl = [['Логин', 'Стоимость вещей кр', 'Стоимость вещей екр', 'Всего кр с учётом вещей', 'Всего екр с учётом вещей']]; foreach ($users as $user) { $itemsprices = Db::getRow('select sum(`1price`) as sumkr, sum(`2price`) as sumekr from items_users where uid = ?', [$user['id']]); $allkr = $user['money'] + $itemsprices['sumkr']; $allekr = $user['money2'] + $itemsprices['sumekr']; $tbl[] = [User::getLogin($user['id']), $itemsprices['sumkr'] ?? 0, $itemsprices['sumekr'] ?? 0, $allkr, $allekr]; } echo Table::get($tbl);