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


PHP Database::disconnect方法代码示例

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


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

示例1: update_comment

 public static function update_comment()
 {
     $sql_query = "UPDATE `comments` SET `comment` = 'This is a Test Mannnnn hehheeh' WHERE `id` = '2'";
     $pdo = Database::connect();
     $pdo->query($sql_query);
     Database::disconnect();
 }
开发者ID:h50n,项目名称:ajax_comment,代码行数:7,代码来源:comment.php

示例2: frameworkDir

 function __construct($commitId = NULL)
 {
     $framework = frameworkDir();
     /* Get the directory of the framework */
     require_once $framework . '/class/Database.class.php';
     $link = new Database();
     $link->connect();
     /* Connect */
     if (!is_null($commitId)) {
         /* Get data */
         $sql = 'SELECT * FROM commits WHERE commitId = %1 ';
         $result = $link->query($sql, $commitId);
         $data = mysql_fetch_object($result);
         /* Set variables */
         $this->_commitId = $commitId;
         $this->_repoId = $data->repoId;
         $this->_commitVal = $data->commitVal;
         $this->_commitMessage = $data->commitMessage;
         $this->_commitDateTime = $data->commitDateTime;
         $this->_commitAuthor = $data->commitAuthor;
     } else {
         $this->_commitId = -1;
         $this->_repoId = -1;
         $this->_commitVal = '';
         $this->_commitMessage = '';
         $this->_commitDateTime = '';
     }
     /* Close link */
     $link->disconnect();
 }
开发者ID:joshelser,项目名称:Repository-Aggregator,代码行数:30,代码来源:Commit.class.php

示例3: increaseSearchDb

 public static function increaseSearchDb()
 {
     $pdo = Database::connect();
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $sql = "UPDATE metricas SET busquedas = busquedas + 1";
     $q = $pdo->prepare($sql);
     $q->execute();
     Database::disconnect();
 }
开发者ID:hugo19941994,项目名称:CV-Parser,代码行数:9,代码来源:database.php

示例4: authenticate

function authenticate($username, $password)
{
    require_once 'lib/functions.lib.php';
    $framework = frameworkDir();
    require_once $framework . '/class/Database.class.php';
    $link = new Database();
    $link->connect();
    $sql = 'SELECT * FROM users WHERE username = %1 AND password = %2 ';
    $result = $link->query($sql, $_POST['username'], md5($_POST['password']));
    if (mysql_num_rows($result) == 1) {
        $data = mysql_fetch_object($result);
        $link->disconnect();
        return $data;
    } else {
        $link->disconnect();
        return false;
    }
}
开发者ID:joshelser,项目名称:Acero-Framework,代码行数:18,代码来源:authentication.php

示例5: delete

 public function delete($id)
 {
     $db = new Database();
     $db->connect();
     $where = 'id=' . $id;
     $result = $db->delete(static::$tableName, $where);
     $returnValue;
     if ($result) {
         $returnValue = TRUE;
     } else {
         $returnValue = FALSE;
     }
     $db->disconnect();
     return $returnValue;
 }
开发者ID:mawilliamson,项目名称:wordpress,代码行数:15,代码来源:taxonomy.php

示例6: disconnect

 public function disconnect()
 {
     try {
         $status = TRUE;
         if (is_resource($this->_connection)) {
             if ($status = mysql_close($this->_connection)) {
                 $this->_connection = NULL;
                 parent::disconnect();
             }
         }
     } catch (Exception $e) {
         $status = !is_resource($this->_connection);
     }
     return $status;
 }
开发者ID:noikiy,项目名称:kohana,代码行数:15,代码来源:MySQL.php

示例7: read

 public static function read($id)
 {
     $sql = "SELECT * FROM users WHERE id=:id";
     try {
         $db = Database::connect();
         $stmt = $db->prepare($sql);
         $stmt->bindParam(":id", $id);
         $stmt->execute();
         $user = $stmt->fetchObject();
         return $user;
         Database::disconnect();
     } catch (PDOException $e) {
         echo 'Error: ' . $e->getMessage();
     }
 }
开发者ID:hotaku6kun,项目名称:Leviantha,代码行数:15,代码来源:user.php

示例8: showAllUsers

 public function showAllUsers()
 {
     $pdo = Database::connect();
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     try {
         $statement = $pdo->prepare("SELECT id,username,email,administrator,blocked FROM users");
         $statement->execute();
     } catch (Exception $e) {
         Database::disconnect();
         return $e->getMessage();
     }
     $data = $statement->fetchAll(PDO::FETCH_ASSOC);
     Database::disconnect();
     echo json_encode($data);
 }
开发者ID:DrNio13,项目名称:love-science,代码行数:15,代码来源:user_controller.php

示例9: readAll

 public static function readAll()
 {
     $sql = "SELECT * FROM suscriptor ORDER BY id";
     try {
         $db = Database::connect();
         $stmt = $db->query($sql);
         $stmt->setFetchMode(PDO::FETCH_OBJ);
         while ($CurrentUser = $stmt->fetch()) {
             echo '<p><b> Nombre: </b>' . $CurrentUser->nombre . '<b> Correo: </b>' . $CurrentUser->correo . '</p>';
         }
         Database::disconnect();
     } catch (PDOException $e) {
         echo 'Error: ' . $e->getMessage();
     }
 }
开发者ID:jimenalitzel,项目名称:Jimena01,代码行数:15,代码来源:user.php

示例10: updateLoginCounter

 public function updateLoginCounter($ip, $counter)
 {
     $pdo = Database::connect();
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $counter = (int) $counter + 1;
     $statement = $pdo->prepare("UPDATE login_attempts SET login_counter=:counter WHERE ip=:ip");
     try {
         $statement->execute(array("ip" => $ip, "counter" => $counter));
         //test
         Database::disconnect();
         return $counter;
     } catch (Exception $e) {
         Database::disconnect();
         return $e->getMessage();
     }
     Database::disconnect();
 }
开发者ID:DrNio13,项目名称:love-science,代码行数:17,代码来源:login_controller.php

示例11: create

 public static function create($Username, $Contrasena)
 {
     $sql = 'INSERT INTO News (Username, Contrasena) VALUES (:Username,:Contrasena)';
     try {
         $db = Database::connect();
         $stmt = $db->prepare($sql);
         $stmt->bindParam(':Username', $Username);
         $stmt->bindParam(':Contrasena', $Contrasena);
         $stmt->execute();
         Database::disconnect();
         echo "<script>alert(':D'); location.href='index.php'</script>";
         return true;
     } catch (PDOException $e) {
         echo 'Error: ' . $e->getMessage();
         return false;
     }
 }
开发者ID:Angysuna,项目名称:SegundoParcial,代码行数:17,代码来源:user.php

示例12: create

 public static function create($CORREO, $CONTRASENA)
 {
     $sql = 'INSERT INTO TABLAWEB (CORREO, CONTRASENA) VALUES (:CORREO,:CONTRASENA)';
     try {
         $db = Database::connect();
         $stmt = $db->prepare($sql);
         $stmt->bindParam(':CORREO', $CORREO);
         $stmt->bindParam(':CONTRASENA', $CONTRASENA);
         $stmt->execute();
         Database::disconnect();
         echo "<script>alert('EL REGISTRO FUE EXITOSO'); location.href='index.php'</script>";
         return true;
     } catch (PDOException $e) {
         echo 'Error: ' . $e->getMessage();
         return false;
     }
 }
开发者ID:soymelisa,项目名称:WEB2,代码行数:17,代码来源:user.php

示例13: fillindevice

function fillindevice()
{
    global $lang, $error, $devid, $devtype, $acreg, $accn, $actype, $notrack, $noident, $twig;
    $catarray = array(1 => 'Gliders/motoGliders', 2 => 'Planes', 3 => 'Ultralights', 4 => 'Helicoters', 5 => 'Drones/UAV', 6 => 'Others');
    $dtypc = array('', '', '');
    $dtypc[$devtype] = 'checked';
    $aircraft = array();
    $dbh = Database::connect();
    $result = $dbh->query('SELECT * FROM aircrafts ORDER BY ac_cat,ac_type');
    foreach ($result as $row) {
        $selected = $row['ac_id'] == $actype ? 'selected' : '';
        $aircraft[$row['ac_cat']][] = array('id' => $row['ac_id'], 'type' => $row['ac_type'], 'selected' => $selected);
    }
    Database::disconnect();
    $template_vars = array('aircrafts' => $aircraft, 'lang' => $lang, 'error' => $error, 'dtypc' => $dtypc, 'catarray' => $catarray, 'cnotrack' => $notrack ? 'checked' : '', 'cnoident' => $noident ? 'checked' : '', 'devid' => $devid, 'acreg' => $acreg, 'accn' => $accn);
    echo $twig->render('fillindevice.html.twig', $template_vars);
}
开发者ID:kerel-fs,项目名称:ogn-ddb,代码行数:17,代码来源:index.php

示例14: get_question_details

 public function get_question_details($qid)
 {
     $result = array();
     $db = new Database();
     if ($db->connect()) {
         if ($db->select('questions', 'q_id,c_id,q_name,q_tag,q_hint,q_points', NULL, 'q_id=' . $qid)) {
             $dbResult = $db->getResult();
             foreach ($dbResult as $out) {
                 $q = new question();
                 $q->set_question_information($out['q_id'], $out['c_id'], $out['q_name'], $out['q_tag'], $out['q_hint'], $out['q_points']);
                 array_push($result, $q);
             }
         }
         $db->disconnect();
     }
     return $result;
 }
开发者ID:shsirk,项目名称:htf,代码行数:17,代码来源:puzzle.php

示例15: get_ScreenName

function get_ScreenName($find)
{
    $pdo = Database::connect();
    $sql = "SELECT * FROM userimagedetails";
    $rows = $pdo->query($sql);
    global $nameArray;
    foreach ($rows as $row) {
        $nameArray = array($row['userName']);
    }
    Database::disconnect();
    //get a return
    foreach ($nameArray as $name) {
        if ($name == $find) {
            return $name;
            break;
        }
    }
}
开发者ID:Lione,项目名称:twitpicScrapper,代码行数:18,代码来源:functions.php


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