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


PHP DbConnect類代碼示例

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


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

示例1: __construct

 function __construct()
 {
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
     //$this->echoAllConstituentNames();
 }
開發者ID:nagasudhirpulla,項目名稱:SchedulingAPI,代碼行數:7,代碼來源:dbtest.php

示例2: __construct

 function __construct()
 {
     require_once 'dbconn.php';
     // CONNESSIONE
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
開發者ID:guerriniStefano,項目名稱:StrikeAndBall,代碼行數:7,代碼來源:services.php

示例3: getAllBirthdays

 function getAllBirthdays()
 {
     $conn = new DbConnect();
     $query = $conn->getHandler()->query("SELECT * FROM dinosaur");
     $result = $query->fetchAll(PDO::FETCH_ASSOC);
     return $result;
 }
開發者ID:rajdeeph,項目名稱:Event-Reminder,代碼行數:7,代碼來源:Query.php

示例4: __construct

 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
開發者ID:amakaroff82,項目名稱:mimi,代碼行數:7,代碼來源:DbHandler.php

示例5: __construct

 function __construct()
 {
     $this->columns = array();
     require_once 'config/DbConnect.php';
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
開發者ID:Cheera,項目名稱:cheera_API,代碼行數:8,代碼來源:CopyOfmodel.php

示例6: __construct

 public function __construct()
 {
     for ($i = 1; $i <= $this->getInitialSize(); $i++) {
         $dbConnect = new DbConnect();
         $dbConnect->setCreated(time());
         $this->addConnect($dbConnect);
     }
 }
開發者ID:sdlyhu,項目名稱:Demo,代碼行數:8,代碼來源:DbFactory.php

示例7: __construct

 function __construct()
 {
     require_once dirname(__FILE__) . '/db_connect.php';
     require_once dirname(__FILE__) . '/mail/class.phpmailer.php';
     require_once dirname(__FILE__) . '/mail/class.smtp.php';
     // opening db connection
     $db = new DbConnect();
     $this->conn = $db->connect();
 }
開發者ID:ars0709,項目名稱:restlog,代碼行數:9,代碼來源:db_mail.php

示例8: __construct

 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     //open new database
     try {
         $db = new DbConnect();
         //instantiate the DbConnect class
         $this->conn = $db->connect();
     } catch (PDOException $ex) {
         $this::dbConnectError($ex->getCode());
     }
 }
開發者ID:pbrooker,項目名稱:StylesbyJudieMac,代碼行數:12,代碼來源:DbHandler.php

示例9: __construct

 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     //open new database connection
     try {
         $db = new DbConnect();
         //instantiate the DbConnect class
         $this->conn = $db->connect();
     } catch (Exception $ex) {
         $this::dbConnectError($ex->getCode());
         exit;
         //unconditionally stop processing
     }
 }
開發者ID:clarktk,項目名稱:bingetunes,代碼行數:14,代碼來源:DbHandler.php

示例10: __construct

 function __construct()
 {
     require_once dirname(__FILE__) . '/DbConnect.php';
     // abriendo conexión
     $db = new DbConnect();
     $this->conn = $db->connect();
     session_start();
     if (isset($_SESSION['user'])) {
         $user_logged_in = true;
     }
     if (isset($_SESSION['copisteria'])) {
         $copisteria_logged_in = true;
     }
 }
開發者ID:krosk93,項目名稱:CodeathonURV2016_Thoimprimeixo,代碼行數:14,代碼來源:DbHandler.php

示例11: getSubcategory

 public function getSubcategory($id)
 {
     $connection = new DbConnect();
     $pdo = $connection->connect();
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $query = "select * from subcategories\n                  where id = :id";
     $stmt = $pdo->prepare($query);
     $stmt->bindParam(':id', $id);
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'Subcategory');
     $stmt->execute();
     $subcategory = $stmt->fetch();
     return $subcategory;
     //return $this;
 }
開發者ID:JyeGoodlet,項目名稱:wda-assignment-2,代碼行數:14,代碼來源:Subcategory.php

示例12: get

 public static function get()
 {
     if (!isset(self::$instance)) {
         self::$instance = new DbConnect();
     }
     return self::$instance;
 }
開發者ID:jessicatsuji,項目名稱:addressbook,代碼行數:7,代碼來源:DbConnect.class.php

示例13: getContacts

 private function getContacts()
 {
     $this->table = 'contacts';
     //Select query
     $this->query_string = "SELECT * FROM %s WHERE user_id = '%s'";
     //Package array for query arguments
     $this->packageArguments();
     //Connect to database
     $this->db = DbConnect::get();
     //Query db
     $this->result = $this->db->query($this->query_string, $this->arguments);
     //Reset Session
     $this->contacts_array = array();
     //Turn result into associative array
     if (mysql_num_rows($this->result)) {
         while ($this->contacts = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
             $this->contact = array('contact_id' => $this->contacts['id'], 'first_name' => $this->contacts['first_name'], 'last_name' => $this->contacts['last_name'], 'phone_one' => $this->contacts['phone_one'], 'phone_two' => $this->contacts['phone_two'], 'phone_three' => $this->contacts['phone_three'], 'email' => $this->contacts['email'], 'company' => $this->contacts['company'], 'address_one' => $this->contacts['address_one'], 'address_two' => $this->contacts['address_two'], 'city' => $this->contacts['city'], 'state' => $this->contacts['state'], 'zip_code' => $this->contacts['zip_code'], 'notes' => $this->contacts['notes']);
             array_push($this->contacts_array, $this->contact);
         }
         return $this->contacts_array;
     } else {
         $this->error_message = "You have No Contacts";
         return $this->error_message;
     }
 }
開發者ID:jessicatsuji,項目名稱:addressbook,代碼行數:25,代碼來源:LoadContacts.class.php

示例14: delete

 public static function delete($id)
 {
     $pdo = DbConnect::connect();
     $sql = "DELETE from abteilung WHERE id=:id";
     $stmt = $pdo->prepare($sql);
     $stmt->execute([':id' => $id]);
 }
開發者ID:bbqgit,項目名稱:DieFirmaAustausch,代碼行數:7,代碼來源:Abteilung.php

示例15: __construct

 public function __construct()
 {
     $db = DbConnect::getInstance();
     $this->conn = $db->getConnection();
     if (!$this->conn) {
         throw new Exception("cannot connect to server");
     }
     return $this->conn;
 }
開發者ID:anb1990,項目名稱:assignment-api,代碼行數:9,代碼來源:Operations.php


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