当前位置: 首页>>代码示例>>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;未经允许,请勿转载。