public function updateBandMember($memberID, $bandMemberDetails, $dbConnection = null)
 {
     $preparedStatement = null;
     $processed = false;
     try {
         if ($bandMemberDetails->getVariable(BandMember::MEMBER_ID) !== null) {
             if ($dbConnection == null) {
                 $dbConnection = DatabaseUtilities::getDatabaseConnection();
             }
             $bandMemberUpdateQuery = BandMemberDao::getBandMemberUpdateQuery($bandMemberDetails);
             $preparedStatement = BandMemberDao::getBandMemberUpdatePreparedStatement($memberID, $bandMemberUpdateQuery, $bandMemberDetails, $dbConnection);
             if ($preparedStatement->execute()) {
                 $processed = true;
             }
             $preparedStatement = null;
         }
     } catch (PDOException $ex) {
         echo 'Caught exception: ' . $ex->getMessage() . "\n";
         $processed = false;
     }
     return $processed;
 }
try {
    $dbConnection = DatabaseUtilities::getDatabaseConnection();
    //Get the current user's ID and details.
    $memberID = LoginController::getLoggedInMemberID($dbConnection);
    if ($memberID == null) {
        $error = true;
        $errorCode = 1;
    } else {
        $bandID = $_POST[EditBandProfileConstants::BAND_ID_INPUT];
        $inputMemberID = $_POST[EditBandProfileConstants::MEMBER_ID_INPUT];
        $encryptedID = $_POST[EditBandProfileConstants::ENCRYPTED_ID_INPUT];
        $key = $_POST[EditBandProfileConstants::KEY];
        if (BandMemberController::processBandMemberSecurityCheck($memberID, $inputMemberID, $encryptedID, $bandID, $key)) {
            if (isset($_POST[EditBandMemberConstants::BAND_MEMBER_EDIT_ID])) {
                $admin = BandMemberDao::selectBandMemberAdmin($bandID, $memberID, $dbConnection);
            }
            $bandMembers = BandMemberDao::selectBandMembers($bandID, $dbConnection);
            if ($bandMembers != null) {
                $processed = true;
                require_once $config->getIncludeURL(Config::INCLUDES_PATH, "views%ajax%band_member_instruments_view.php");
            }
        }
    }
} catch (Exception $ex) {
    $processed = false;
}
$dbConnection = null;
if (!$processed) {
    //TODO
    echo "";
}
require_once "../config.php";
require_once $config->getIncludeURL(Config::INCLUDES_PATH, "controllers%band_member_controller.php");
require_once $config->getIncludeURL(Config::INCLUDES_PATH, "constants%edit_band_profile_constants.php");
require_once $config->getIncludeURL(Config::INCLUDES_PATH, "daos%band_member_dao.php");
require_once $config->getIncludeURL(Config::INCLUDES_PATH, "common_includes.php");
$dbConnection = null;
$processed = false;
try {
    $dbConnection = DatabaseUtilities::getDatabaseConnection();
    //Get the current user's ID and details.
    $memberID = LoginController::getLoggedInMemberID($dbConnection);
    if ($memberID == null) {
        $error = true;
        $errorCode = 1;
    } else {
        $bandID = $_POST[EditBandProfileConstants::BAND_ID_INPUT];
        $inputMemberID = $_POST[EditBandProfileConstants::MEMBER_ID_INPUT];
        $encryptedID = $_POST[EditBandProfileConstants::ENCRYPTED_ID_INPUT];
        $key = $_POST[EditBandProfileConstants::KEY];
        if (BandMemberController::processBandMemberSecurityCheck($memberID, $inputMemberID, $encryptedID, $bandID, $key)) {
            echo BandMemberDao::selectBandMemberAdmin($bandID, $memberID, $dbConnection);
            $processed = true;
        }
    }
} catch (Exception $ex) {
    $processed = false;
}
$dbConnection = null;
if (!$processed) {
    echo "0";
}
 public function isBandMemberAdmin($bandID, $memberID, $dbConnection)
 {
     $admin = false;
     try {
         $admin = BandMemberDao::selectBandMemberAdmin($bandID, $memberID, $dbConnection);
     } catch (Exception $ex) {
         echo "isBandMemberAdmin error: " . $ex->getMessage();
         $admin = false;
     }
     return $admin;
 }
 public function searchBandsByMemberID($memberID, $currentPage, $pagingAmount, $dbConnection = null)
 {
     $bandSearchResults = null;
     $bandSkeletons = null;
     try {
         $bandParameters = new SearchParameters();
         $bandParameters->setVariable(SearchConstants::CURRENT_PAGE_ID, $currentPage);
         $bandParameters->setVariable(SearchConstants::PAGING_AMOUNT_ID, $pagingAmount);
         $bandParameters->setVariable(BandSearchConstants::MEMBER_INPUT_ID, $memberID);
         $bandCount = BandSearchDao::getBandSearchCount($bandParameters, $dbConnection);
         $bandSkeletons = BandSearchDao::searchBands($bandParameters, $dbConnection);
         if ($bandSkeletons != null) {
             foreach ($bandSkeletons as $bandSkeleton) {
                 $bandSkeleton->setVariable(BandMember::ADMIN, BandMemberDao::selectBandMemberAdmin($bandSkeleton->getVariable(Band::BAND_ID), $memberID, $dbConnection));
             }
         }
         $bandSearchResults = new SearchResults();
         $bandSearchResults->setVariable(SearchResults::SEARCH_PARAMETERS, $bandParameters);
         $bandSearchResults->setVariable(SearchResults::SKELETONS, $bandSkeletons);
         $bandSearchResults->setVariable(SearchResults::COUNT, $bandCount);
         $bandSearchResults->setVariable(SearchResults::PAGE_COUNT, ceil($bandCount / $pagingAmount));
     } catch (Exception $ex) {
         $bandSearchResults = null;
         echo 'Caught exception: ' . $ex->getMessage();
     }
     return $bandSearchResults;
 }