public function getLogin($user_id, $db) { $user = new User(); $user->id = $user_id; $usermapper = new UserMapper($db); $result = $usermapper->selectById($user); if (empty($result)) { $login = "******"; } else { foreach ($result as $value) { if ($value['login'] != NULL) { $login = $value['login']; } else { $login = "******"; } } } return $login; }