當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DatabaseManager::establishConnection方法代碼示例

本文整理匯總了PHP中DatabaseManager::establishConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP DatabaseManager::establishConnection方法的具體用法?PHP DatabaseManager::establishConnection怎麽用?PHP DatabaseManager::establishConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager::establishConnection方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: approveRestriction

 public function approveRestriction($restrictionId, $restrictionTable, $approval)
 {
     //create instance of Database Manager object
     $dbMan = new DatabaseManager();
     //establish connection
     //if returns false, connection failed
     if (!$dbMan->establishConnection()) {
         //database connection error
         return false;
     }
     //if approval is true - change restriction status to active
     if ($approval) {
         /* Create new request to get all pending airline restrictions */
         $request = new Request('Approve Restriction', $restrictionTable);
         $request->addParameter('restriction_id', $restrictionId);
         $request->addParameter('status', 'ACTIVE');
     } else {
         if (!$approval) {
             /* Create new request to get all pending airline restrictions */
             $request = new Request('Delete Restriction', $restrictionTable);
             $request->addParameter('restriction_id', $restrictionId);
         }
     }
     //transform the command to sql statement
     $request->transformCommand();
     //execute command
     $results = $dbMan->executeQuery($request);
     //if results is not null, command was successfully executed.
     if ($results != null) {
         //successfully approved
         return true;
     }
     //command was not successfully executed.
     return false;
 }
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:35,代碼來源:SuperUser.php

示例2: getAirlines

function getAirlines()
{
    $dbMan = new DatabaseManager();
    if (!$dbMan->establishConnection()) {
        //database connection error
        return;
    }
    $request = new Request('SELECT *', 'se_Airlines');
    $request->transformCommand();
    $users = $dbMan->executeQuery($request);
    //server error
    if ($users == null) {
        //request was unsuccessful
    } else {
        if ($users->num_rows) {
            /* Get number of rows returned */
            $rows = $users->num_rows;
            /* For each row - push the airline name
             * onto the $airlines array */
            for ($i = 0; $i < $rows; ++$i) {
                $users->data_seek($i);
                $row = $users->fetch_array(MYSQLI_NUM);
                echo "<option>" . $row[0] . "</option>";
            }
        }
    }
}
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:27,代碼來源:addRestriction.php

示例3: removeRestrictionRequest

 public function removeRestrictionRequest($restrictionId, $restrictionTable)
 {
     //create instance of Database Manager object
     $dbMan = new DatabaseManager();
     //establish connection
     //if returns false, connection failed
     if (!$dbMan->establishConnection()) {
         //database connection error
         return false;
     }
     /* Create new request to remove restriction*/
     $request = new Request('Delete Restriction', $restrictionTable);
     $request->addParameter('restriction_id', $restrictionId);
     //transform the command to sql statement
     $request->transformCommand();
     //execute command
     $results = $dbMan->executeQuery($request);
     //if results is not null, command was successfully executed.
     if ($results != null) {
         //successfully approved
         return true;
     }
     //command was not successfully executed.
     return false;
 }
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:25,代碼來源:Administrator.php

示例4: getNonRestrictedRegions

 public function getNonRestrictedRegions()
 {
     $regions = array();
     $dbMan = new DatabaseManager();
     /* Establish connection with database
      * if the establishConnection function
      * returns false, a connection error occured*/
     if (!$dbMan->establishConnection()) {
         //database connection error
         return;
     }
     /* Create request to get valid airlines for user_id provided */
     $request = new Request('getValidRegions', 'se_Region_Restrictions');
     $request->addParameter('user_id', $this->id);
     /* Transform the Request into an MySQL command*/
     $request->transformCommand();
     /* Execute command to get valid Regions */
     $validRegions = $dbMan->executeQuery($request);
     //server error
     if ($validRegions == null) {
         //request was unsuccessful
     } else {
         if ($validRegions->num_rows) {
             /* Get number of rows returned */
             $rows = $validRegions->num_rows;
             /* For each row - push the region name
              * onto the $regions array */
             for ($i = 0; $i < $rows; ++$i) {
                 $validRegions->data_seek($i);
                 $row = $validRegions->fetch_array(MYSQLI_NUM);
                 /* Push value onto array */
                 array_push($regions, $row[0]);
             }
         }
     }
     /* Return Valid Regions */
     return $regions;
 }
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:38,代碼來源:GeneralUser.php

示例5: DatabaseManager

								<th>Restricted Region</th>
								<th>Status</th>
								<th></th>
								<?php 
    if ($user->type == 'SUPER_USER') {
        echo "<th></th>";
    }
    ?>
							</tr>
						</thead>	
						<tbody>
						<?php 
    /* Create new instance of database manager */
    $dbMan = new DatabaseManager();
    /* Establish Connection with the database */
    if (!$dbMan->establishConnection()) {
        //database connection error
        return;
    }
    /* Create new request to get all pending airline restrictions */
    $request = new Request('getPendingRegionRestrictions', 'se_Region_Restrictions');
    $request->transformCommand();
    /* Execute query */
    $results = $dbMan->executeQuery($request);
    if ($results == null) {
        //request failed
    } else {
        $rows = $results->num_rows;
        for ($i = 0; $i < $rows; ++$i) {
            $results->data_seek($i);
            $row = $results->fetch_array(MYSQLI_NUM);
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:31,代碼來源:manageUserRestrictions.php

示例6: updateUserPassword

function updateUserPassword($userId)
{
    /* Create new instance of database manager */
    $dbMan = new DatabaseManager();
    /* Establish connection with server */
    if (!$dbMan->establishConnection()) {
        //database connection error
        return;
    }
    /* Create new request to update user password */
    $request = new Request('UPDATE', 'se_Users');
    $request->addParameter('user_id', $userId);
    /* If the new passwords entered by the user match */
    if ($_POST['MY_ACCOUNT_PASSWORD'] == $_POST['MY_ACCOUNT_VERIFY_PASSWORD']) {
        $email = $_SESSION['user']->email;
        $password = $_POST['MY_ACCOUNT_PASSWORD'];
        $hashedPassword = hash('ripemd128', "g!cT{$email}{$password}");
        $request->addParameter('password', $hashedPassword);
    } else {
        unmatchedPasswords();
        return;
    }
    /* Transform request into SQL command */
    $request->transformCommand();
    /* Results returned from server */
    $results = $dbMan->executeQuery($request);
    //server error
    if ($results == null) {
        //request was unsuccessful
    } else {
        accountUpdateSuccess();
    }
}
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:33,代碼來源:manageAccount.php

示例7: getNumberOfPendingAccounts

function getNumberOfPendingAccounts()
{
    $dbMan = new DatabaseManager();
    if (!$dbMan->establishConnection()) {
        //database connection error
        return;
    }
    $request = new Request('SELECT *', 'se_Users');
    $request->addParameter('status', 'PENDING_APPROVAL');
    $request->transformCommand();
    $results = $dbMan->executeQuery($request);
    if ($results == null) {
        //request failed
    }
    return $rows = $results->num_rows;
}
開發者ID:sgacevedo,項目名稱:asdi-feed-analyzer,代碼行數:16,代碼來源:home.php


注:本文中的DatabaseManager::establishConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。