当前位置: 首页>>代码示例>>PHP>>正文


PHP DBConnection::closeConnection方法代码示例

本文整理汇总了PHP中DBConnection::closeConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::closeConnection方法的具体用法?PHP DBConnection::closeConnection怎么用?PHP DBConnection::closeConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBConnection的用法示例。


在下文中一共展示了DBConnection::closeConnection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getEvents

 public static function getEvents()
 {
     $db = new DBConnection();
     $link = $db->connect();
     if ($link != null) {
         $query = "SELECT event_name,start_date,end_date,start_time FROM event";
         $result = $link->query($query);
         $result_array = array();
         $index = 0;
         while ($row = mysqli_fetch_assoc($result)) {
             $result_array[$index] = $row;
             $index = $index + 1;
         }
         $db->closeConnection();
         return $result_array;
     }
     $db->closeConnection();
     return null;
 }
开发者ID:lahiiru,项目名称:moraspirit,代码行数:19,代码来源:EventAccess.php

示例2: storeError

 /**
  * Metodo para almacenar la informacion de los errores en los querys ejecutados.
  * 
  * @param string $queryOperation
  * @param string $result
  */
 private static function storeError($queryOperation, $result)
 {
     if (DBUtil::$STORE_LOGS) {
         $idUsuario = "NULL";
         $time0 = time();
         if (isset($_SESSION["usuario"])) {
             $idUsuario = $_SESSION["usuario"]->getId();
         }
         $query = "INSERT INTO system_log (fecha, query, result, was_error, query_time, id_usuario)" . " VALUES(now(),'" . str_replace("'", "\\'", $queryOperation) . "','" . str_replace("'", "\\'", $result) . "','1'," . (time() - $time0) . "," . $idUsuario . ")";
         $dbConObj = new DBConnection();
         mysql_query($query, $dbConObj->getConnection());
         $dbConObj->closeConnection();
     } else {
         echo $result;
     }
 }
开发者ID:xmachadox3,项目名称:fjrsomecode,代码行数:22,代码来源:DBUtil.php

示例3: restore

 public function restore()
 {
     // we need root database access to re-create tables
     $rconn = DBConnection::getRootConnection();
     if ($rconn->connect_error) {
         throw new Exception("Cannot perform upgrade process: database::dbConnect()");
     }
     session_start();
     unset($_SESSION['progress']);
     session_write_close();
     // phase 1: retrieve file from http request
     $data = $this->retrieveDBFile();
     // phase 2: verify received file
     if (strpos(substr($data, 0, 25), "-- AgilityContest") === FALSE) {
         throw new Exception("Provided file is not an AgilityContest backup file");
     }
     // phase 3: delete all tables and structures from database
     $this->dropAllTables($rconn);
     // phase 4: parse sql file and populate tables into database
     $this->readIntoDB($rconn, $data);
     // phase 5 final tests
     DBConnection::closeConnection($rconn);
     return "";
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:24,代码来源:adminFunctions.php

示例4: getMemberDetail

 public static function getMemberDetail($id)
 {
     $db = new DBConnection();
     $link = $db->connect();
     if ($link != null) {
         $query = "SELECT concat(first_name,\" \",last_name) AS name  , gender , email ,mobile   FROM member WHERE id ='" . $id . "'";
         $result = $link->query($query);
         $db->closeConnection();
         return $result;
     }
     $db->closeConnection();
     return null;
 }
开发者ID:lahiiru,项目名称:moraspirit,代码行数:13,代码来源:ResourceAccess.php

示例5: storeError

 /**
  * Metodo para almacenar la informacion de los errores en los querys ejecutados.
  * 
  * @param string $queryOperation
  * @param string $result
  */
 private static function storeError($queryOperation, $result)
 {
     if (DBUtil::$storeErrors == true) {
         $idUsuario = "NULL";
         $time0 = time();
         if (isset($_SESSION["usuario"])) {
             $idUsuario = $_SESSION["usuario"]->getId();
         }
         $dbConObj = new DBConnection();
         $query = "INSERT INTO system_log (fecha, query, result, was_error, query_time, id_usuario)" . " VALUES(now(),'" . mysql_real_escape_string($queryOperation, $dbConObj->getConnection()) . "','" . mysql_real_escape_string($result, $dbConObj->getConnection()) . "','1'," . (time() - $time0) . "," . $idUsuario . ")";
         mysql_query($query, $dbConObj->getConnection());
         $dbConObj->closeConnection();
     }
 }
开发者ID:xmachadox3,项目名称:fjrsomecode,代码行数:20,代码来源:DBUtil.php

示例6: mysql_error

$query .= "(SELECT vd1.idventa FROM vista_ventas_detalles vd1 WHERE vd1.fecha_venta='" . $_GET["date"] . "' GROUP BY vd1.idventa) vd2 ";
$query .= "WHERE vd.anulado = 0  AND vd.idventa = vd2.idventa ORDER BY vd.idventa, vd.idventa_detalle";
echo "En VentasDAO::calcularTicketGanador -> iniciando '" . $query . "'<br /><br />";
$resultArray = array();
$time0 = time();
$dbConObj = new DBConnection();
echo "Fecha: " . $_GET["date"] . "<br /><br />";
ini_set('memory_limit', '1024M');
try {
    $result = mysql_query($query, $dbConObj->getConnectionV2());
    if (!mysql_error()) {
        while ($r = mysql_fetch_array($result)) {
            $resultArray[] = $r;
        }
        echo "count(resultArray)= " . count($resultArray) . "<br /><br />";
    } else {
        echo "mysql_error(): " . mysql_error() . "<br /><br />";
    }
} catch (Exception $e) {
    echo "Error ejecutando consulta en base de datos" . $e . "<br /><br />";
}
$dbConObj->closeConnection();
echo mysql_error() . "<br />";
echo "En VentasDAO::calcularTicketGanador -> ejecutado '" . $query . "<br /><br />";
if (count($result) > 0) {
    foreach ($result as $venta) {
        print_r($venta);
    }
} else {
    echo "result esta vacio";
}
开发者ID:xmachadox3,项目名称:fjrsomecode,代码行数:31,代码来源:testQuery.php


注:本文中的DBConnection::closeConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。