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