$dbConnection = DatabaseUtilities::getDatabaseConnection(); //Get the current user's ID and details. $memberID = LoginController::getLoggedInMemberID($dbConnection); if ($memberID == null) { header("Location: login.php"); exit; } else { $currentPage = 1; $pagingAmount = 10; if (isset($_GET[SearchConstants::PAGING_AMOUNT_ID])) { $pagingAmount = $_GET[SearchConstants::PAGING_AMOUNT_ID]; } if (isset($_GET[SearchConstants::PAGING_AMOUNT_ID])) { $currentPage = $_GET[SearchConstants::CURRENT_PAGE_ID]; } $advertisementSearchResults = AdvertisementSearchController::searchAdvertisementsByMemberID($memberID, $currentPage, $pagingAmount, $dbConnection); //If member details cannot be obtained, error if ($advertisementSearchResults == null) { $errorCode = 1; } else { $advertisementSearchParameters = $advertisementSearchResults->getVariable(SearchResults::SEARCH_PARAMETERS); $processed = true; } } } catch (Exception $ex) { $processed = false; $errorCode = 1; } $dbConnection = null; if (!$processed) { ErrorUtilities::errorRedirect($errorCode);