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


PHP Conn類代碼示例

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


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

示例1: giveAuthor

 public static function giveAuthor($id)
 {
     $db = new Conn();
     if ($id == '0') {
         return 'Anonymous';
     } else {
         $author = mysql_fetch_array($db->db_query("SELECT username FROM members WHERE id='{$id}'"));
         return $author['username'];
     }
 }
開發者ID:Chocksy,項目名稱:opiniodev-feedback-forum,代碼行數:10,代碼來源:render.class.php

示例2: findAll

 /**
  * <b>Não é passado com os Joins</b>
  * 
  * @return array[Objetos]
  */
 public function findAll()
 {
     $sql = "SELECT * FROM {$this->Table}";
     $this->Stmt = Conn::prepare($sql);
     $this->Stmt->execute();
     return $this->Stmt->fetchAll();
 }
開發者ID:adrianosilvareis,項目名稱:FrameWork_Front,代碼行數:12,代碼來源:Business.class.php

示例3: Connect

 private function Connect()
 {
     // obteve a conexão
     $this->conn = parent::getConn();
     //cria a query
     $this->create = $this->conn->prepare($this->create);
 }
開發者ID:brenolessa,項目名稱:projeto-RI-Br,代碼行數:7,代碼來源:Create.class.php

示例4: Connect

 /**
  * ****************************************
  * *********** PRIVATE METHODS ************
  * ****************************************
  */
 private function Connect()
 {
     $this->Conn = parent::getConn();
     $this->Read = $this->Conn->prepare($this->Select);
     // Retornar resultados em arrays
     $this->Read->setFetchMode(PDO::FETCH_ASSOC);
 }
開發者ID:BrunoDuarte,項目名稱:WS_PHP_ADMIN,代碼行數:12,代碼來源:Read.class.php

示例5: updateAccount

 /**
  * @param $Account ClientAccount
  */
 public static function updateAccount($Account)
 {
     include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
     $sql = "UPDATE ClientAccount SET Balance = ? WHERE AccountNum = ?";
     $stmt = Conn::get()->prepare($sql);
     $stmt->execute(array($Account->getBalance(), $Account->getAccountNum()));
 }
開發者ID:elmo911,項目名稱:WolfeSolutions,代碼行數:10,代碼來源:ClientAccount.php

示例6: addDependent

 /**
  * @param $employee Employee
  * @param $dependent Dependent
  */
 public static function addDependent($employee, $dependent)
 {
     include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
     $sql = "INSERT INTO Dependents (EID, CID, Fname, Lname, Relation, Birthday) VALUES (?, ?, ?, ?, ?, ?)";
     $stmt = Conn::get()->prepare($sql);
     $stmt->execute(array($employee->getEID(), $employee->getCID(), $dependent->getFname(), $dependent->getLname(), $dependent->getRelation(), $dependent->Birthday));
 }
開發者ID:elmo911,項目名稱:WolfeSolutions,代碼行數:11,代碼來源:Dependent.php

示例7: Connect

 /**
  * PRIVATE METODOS
  */
 private function Connect()
 {
     /** Pega a Conexão com a Class Pai Conn e atribui ao $this->Conn */
     $this->Conn = parent::getConn();
     /** Cria o Prepare Statement do Select */
     $this->Update = $this->Conn->prepare($this->Update);
 }
開發者ID:hsnunes,項目名稱:drmeatende,代碼行數:10,代碼來源:Update.class.php

示例8: Connect

 /**
  * PRIVATE METODOS
  */
 private function Connect()
 {
     /** Pega a Conexão com a Class Pai Conn e atribui ao $this->Conn */
     $this->Conn = parent::getConn();
     /** Cria o Prepare Statement do Select */
     $this->Read = $this->Conn->prepare($this->Select);
     /** Seta o retorno dos dados no Formato fetch_assoc */
     $this->Read->setFetchMode(PDO::FETCH_ASSOC);
 }
開發者ID:hsnunes,項目名稱:drmeatende,代碼行數:12,代碼來源:Read.class.php

示例9: getRoleList

 public static function getRoleList()
 {
     include_once "../../bossflex/DB/Conn.php";
     $sql = "SELECT RoleID, Role\n                FROM UserRole\n                ORDER BY RoleID DESC \n                LIMIT 0 , 30";
     $stmt = Conn::get()->query($sql, PDO::FETCH_ASSOC);
     $roleList = array();
     while ($role = $stmt->fetchObject(__CLASS__)) {
         $roleList[] = $role;
     }
     return $roleList;
 }
開發者ID:elmo911,項目名稱:WolfeSolutions,代碼行數:11,代碼來源:UserRole.php

示例10: getCodeList

 public static function getCodeList()
 {
     include_once "../../bossflex/DB/Conn.php";
     $sql = "SELECT Code, Reason\n                FROM DisableCode";
     $stmt = Conn::get()->query($sql, PDO::FETCH_ASSOC);
     $codeList = array();
     while ($code = $stmt->fetchObject(__CLASS__)) {
         $codeList[] = $code;
     }
     return $codeList;
 }
開發者ID:elmo911,項目名稱:WolfeSolutions,代碼行數:11,代碼來源:DisableCode.php

示例11: getReport

 public static function getReport()
 {
     include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
     $conn = Conn::get();
     $sql = "SELECT * FROM Exception ORDER BY TimeStamp DESC";
     try {
         return $conn->query($sql);
     } catch (Exception $e) {
         return null;
     }
 }
開發者ID:elmo911,項目名稱:WolfeSolutions,代碼行數:11,代碼來源:ErrorReport.php

示例12: BackupDatabase

 public function BackupDatabase($database)
 {
     $connection = parent::getConnection();
     // try{
     //     $backup = $connection->prepare('mysqldump -u root -p 123456 '. $database .' > ' . HOME . 'archives/backup.sql');
     //     $backup->execute();
     //     return true;
     // }catch(Exception $e){
     //     return false;
     //     $this->result = $e;
     // }
     return system('mysqldump -u root -p 123456 ' . $database . ' > ' . HOME . 'archives/backup.sql');
 }
開發者ID:Ritotsume,項目名稱:schoolbus,代碼行數:13,代碼來源:ModelAdmin.class.php

示例13: PDO

 /**
  * 數據庫連接
  */
 public static function &getConn()
 {
     if (self::$conn == null) {
         $conn = new PDO(sprintf(Config::DB_LINK, DIR_ROOT), "charset=UTF-8");
         if (IS_DEBUG) {
             $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         } else {
             $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
         }
         self::$conn = $conn;
     }
     return self::$conn;
 }
開發者ID:BGCX261,項目名稱:zoeeyphp-hg-to-git,代碼行數:16,代碼來源:Conn.php

示例14: depositAmt

 public static function depositAmt($AccountNum, $DepositedByUID, $Amount, $PayRollDate)
 {
     include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
     $db = Conn::get();
     $sql = "INSERT INTO Deposit (AccountNum, DepositedByUID, Amount, PayRollDate) VALUES (?, ?, ?, ?)";
     $stmt = $db->prepare($sql);
     $stmt->execute(array($AccountNum, $DepositedByUID, $Amount, $PayRollDate));
     $depID = $db->lastInsertId();
     $sql = "SELECT * FROM Deposit WHERE DepositID = :id";
     $stmt = Conn::get()->prepare($sql);
     $stmt->bindParam(":id", $depID, PDO::PARAM_INT);
     $stmt->execute();
     return $stmt->fetchObject(__CLASS__);
 }
開發者ID:elmo911,項目名稱:WolfeSolutions,代碼行數:14,代碼來源:Deposit.php

示例15: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:grzesieksocha,項目名稱:myTweet,代碼行數:7,代碼來源:class.DbConnect.inc.php


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