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


PHP dbConnect類代碼示例

本文整理匯總了PHP中dbConnect的典型用法代碼示例。如果您正苦於以下問題:PHP dbConnect類的具體用法?PHP dbConnect怎麽用?PHP dbConnect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: __construct

 /**
  * constructor
  **/
 function __construct()
 {
     require_once dirname(__FILE__) . '/dbConnect.php';
     //Open DB connection
     $db = new dbConnect();
     $this->conn = $db->connect();
 }
開發者ID:hndr91,項目名稱:untukpati-slim,代碼行數:10,代碼來源:dbHandler.php

示例2: __construct

 function __construct()
 {
     require_once 'dbConnect.php';
     // opening db connection
     $db = new dbConnect();
     $this->conn = $db->connect();
 }
開發者ID:jackpower,項目名稱:objectivemoney-angular,代碼行數:7,代碼來源:dbHandler.php

示例3: __construct

 function __construct()
 {
     require_once dirname(__FILE__) . '/dbConnect.php';
     $db = new dbConnect();
     //Connect to database
     $this->con = $db->connect();
     //Select "friends" collection, already defined in config.php
     $this->col = new MongoCollection($this->con, DB_COLLECTION);
 }
開發者ID:hndr91,項目名稱:slim-mongo,代碼行數:9,代碼來源:dbHandler.php

示例4: createTable

 function createTable($name, $query)
 {
     $db = new dbConnect();
     global $conn;
     $result = mysqli_query($db->connect(), "create table if not exists {$name}({$query})");
     if (!$result) {
         die('failed to connect [' . $conn->connect_error . ']');
     }
     echo "Table '{$name}' created already.<br>";
 }
開發者ID:Yuhuu,項目名稱:Plan-with-fun,代碼行數:10,代碼來源:db_handler.php

示例5: doWork

function doWork()
{
    try {
        $dbh = dbConnect::getInstance()->dbh;
    } catch (PDOException $e) {
        print "Error!: " . $e->getMessage() . "<br/>";
        die;
    }
    if (empty($_POST["isDelete"])) {
        $sql = "insert into material (material_type, description) values ";
        $sql .= "(:material_type, :description) ";
        $sql .= "on duplicate key update description = :description ";
        $stmt = $dbh->prepare($sql);
        $stmt->bindValue(":material_type", $_POST["txtMaterialType"]);
        $stmt->bindValue(":description", $_POST["txtDescription"]);
    } else {
        $sql = "delete from material where material_type = :material_type ";
        $stmt = $dbh->prepare($sql);
        $stmt->bindValue(":material_type", $_POST["isDelete"]);
    }
    if ($stmt->execute()) {
        header("Content-Type: application/json");
        echo json_encode(array("result" => "success"));
    } else {
        header("Content-Type: application/json");
        echo json_encode($stmt->errorInfo());
    }
}
開發者ID:pkManee,項目名稱:couple-master-project,代碼行數:28,代碼來源:ManageMaterialType.data.php

示例6: __construct

 public function __construct($id)
 {
     $this->pdo = dbConnect::getInstance();
     $this->id = $id;
     $query = $this->pdo->query("SELECT * FROM shipy_user WHERE id = '" . $this->id . "' ");
     $this->row = $query->fetch(PDO::FETCH_ASSOC);
 }
開發者ID:axelschelfhout,項目名稱:webapp,代碼行數:7,代碼來源:userInfo.class.php

示例7: login

 function login($uname, $password, $checked)
 {
     $db = dbConnect::getInstance();
     $mysqli = $db->getConnection();
     $query = "SELECT * FROM users_tb WHERE mail= '" . $uname . "' AND pass = '" . md5($password) . "'";
     $res = $mysqli->query($query);
     if (mysqli_num_rows($res) > 0) {
         $row = mysqli_fetch_array($res);
         if ($row['type'] != "3") {
             $_SESSION['cafeteriaSystem'] = $row['id'];
             $_SESSION['type'] = $row['type'];
             $_SESSION['name'] = $row['name'];
             $_SESSION['pic'] = $row['pic_path'];
             //echo $_SESSION['php'];
             if ($checked == "1") {
                 setcookie("cafeteriaSystem", $row['id'], time() + 3600);
                 //echo $_COOKIE['php'];
             }
             if ($row['type'] == "1") {
                 header("location:orders.php");
             } else {
                 header("location:index.php");
             }
             return TRUE;
         }
     } else {
         return false;
     }
 }
開發者ID:Mayyad,項目名稱:Tigers,代碼行數:29,代碼來源:uLogin.php

示例8: doWork

function doWork()
{
    try {
        $dbh = dbConnect::getInstance()->dbh;
    } catch (PDOException $e) {
        print "Error!: " . $e->getMessage() . "<br/>";
        die;
    }
    $sql = "update member set member_name = :member_name, address = :address, password = :password ";
    $sql .= ",province_id = :province_id, province_name = :province_name ";
    $sql .= ",amphur_id = :amphur_id, amphur_name = :amphur_name, ";
    $sql .= ",district_id = :district_id, district_name = :district_name ";
    $sql .= ",postcode = :postcode ";
    $sql .= "where email = :email";
    $stmt = $dbh->prepare($sql);
    $stmt->bindValue(":member_name", $_POST["txtName"]);
    $stmt->bindValue(":address", $_POST["txtAddress"]);
    $stmt->bindValue(":password", $_POST["txtPassword"]);
    $stmt->bindValue(":province_id", doExplode($_POST["cboProvince"])[0]);
    $stmt->bindValue(":province_name", doExplode($_POST["cboProvince"])[1]);
    $stmt->bindValue(":amphur_id", doExplode($_POST["cboAmphur"])[0]);
    $stmt->bindValue(":amphur_name", doExplode($_POST["cboAmphur"])[1]);
    $stmt->bindValue(":district_id", doExplode($_POST["cboDistrict"])[0]);
    $stmt->bindValue(":district_name", doExplode($_POST["cboDistrict"])[1]);
    $stmt->bindValue(":postcode", $_POST["txtPostCode"]);
    $stmt->bindValue(":email", $_POST["email"]);
    if ($stmt->execute()) {
        header("Content-Type: application/json");
        echo json_encode(array("result" => "success"));
    } else {
        header("Content-Type: application/json");
        echo json_encode($stmt->errorInfo());
    }
}
開發者ID:pkManee,項目名稱:couple-master-project,代碼行數:34,代碼來源:_EditProfile.data.php

示例9: deleteShirtSize

function deleteShirtSize()
{
    try {
        $dbh = dbConnect::getInstance()->dbh;
    } catch (PDOException $e) {
        echo "Error!: " . $e->getMessage() . "<br/>";
        die;
    }
    $sql = "delete from shirt_size where size_code = :size_code and gender = :gender ";
    $stmt = $dbh->prepare($sql);
    $stmt->bindValue(":size_code", $_POST["size_code"]);
    $stmt->bindValue(":gender", $_POST["gender"]);
    header("Content-Type: application/json");
    if ($stmt->execute()) {
        echo json_encode(array("result" => "success"));
    } else {
        //echo json_encode($stmt->errorInfo());
        $errorCode = $stmt->errorCode();
        if ($errorCode == '23000') {
            echo json_encode(array('result' => 'ไม่สามารถลบได้ เนื่องจากได้มีการใช้ข้อมูลนี้ไปแล้ว !!!'));
        } else {
            echo json_encode($stmt->errorInfo());
        }
    }
}
開發者ID:pkManee,項目名稱:couple-master-project,代碼行數:25,代碼來源:ManageShirtSize.data.php

示例10: mcacc_get_acc_list

function mcacc_get_acc_list()
{
    $mc_db = dbConnect::getInstance();
    if (!is_user_logged_in()) {
        log("Neprisijunges vartotojas bando pasitikrinti savo acc ip: " . $_SERVER['REMOTE_ADDR']);
        return;
    }
}
開發者ID:VytautasBoznis,項目名稱:Mc-Acc-Controll-Wordpress,代碼行數:8,代碼來源:mcacclist.php

示例11: newWord

 public static function newWord()
 {
     $newWordID = self::getRandomID();
     $sql = "SELECT * FROM word WHERE ID={$newWordID}";
     $result = dbConnect::runSQL($sql);
     $word = $result->fetch_assoc();
     $wordLetters = str_split($word['word']);
     $word['wordLetters'] = $wordLetters;
     return $word;
 }
開發者ID:k-lusine,項目名稱:guessgame,代碼行數:10,代碼來源:model.php

示例12: execute

 public function execute($sql)
 {
     $exe = mysql_query($sql, $this->_connAccess->getConnection());
     if (!$exe) {
         exit('Error : ' . mysql_error() . ':' . $sql);
     } else {
         return $exe;
         dbConnect::closeConnection();
     }
 }
開發者ID:naufaldxdfam,項目名稱:pdo-collection,代碼行數:10,代碼來源:db.php

示例13: getActiveCSS

 public static function getActiveCSS()
 {
     $db = dbConnect::getReadOnly();
     $query = "SELECT * FROM CSSTemplates WHERE ActiveState=1;";
     $results = mysqli_query($db, $query);
     $row = mysqli_fetch_assoc($results);
     $activeCSSTemplate = new self($row);
     dbConnect::closeConnection($db);
     return $activeCSSTemplate;
 }
開發者ID:ColinHill,項目名稱:PHP-content-management-system,代碼行數:10,代碼來源:cssTemplate.php

示例14: getContentArea

 public static function getContentArea()
 {
     $db = dbConnect::getReadOnly();
     $query = "SELECT * FROM ContentAreas;";
     $results = mysqli_query($db, $query);
     while ($row = mysqli_fetch_assoc($results)) {
         $contentAreas[] = new self($row);
     }
     //end while
     dbConnect::closeConnection($db);
     return $contentAreas;
 }
開發者ID:ColinHill,項目名稱:PHP-content-management-system,代碼行數:12,代碼來源:contentArea.php

示例15: getArticle

 public static function getArticle($_area, $_page)
 {
     $db = dbConnect::getReadOnly();
     $query = "SELECT * FROM Articles WHERE (Page='{$_page}' OR AllPages=1) AND ContentArea = '{$_area}';";
     $result = mysqli_query($db, $query);
     while ($row = mysqli_fetch_assoc($result)) {
         $articleArray[] = new self($row);
     }
     //end while
     dbConnect::closeConnection($db);
     return $articleArray;
 }
開發者ID:ColinHill,項目名稱:PHP-content-management-system,代碼行數:12,代碼來源:article.php


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