• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Conn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Conn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: Connection

 private static function Connection()
 {
     if (self::$connect == null) {
         try {
             $dsn = 'mysql:host=' . self::$host . ';dbname=' . self::$database;
             $options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'set names utf8'];
             self::$connect = new PDO($dsn, self::$user, self::$pass, $options);
         } catch (PDOException $ex) {
             die('Erro: ' . $ex->getMessage());
         }
     }
     self::$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return self::$connect;
 }
开发者ID:Ritotsume,项目名称:schoolbus,代码行数:14,代码来源:Conn.class.php


示例16: conectar

 /**
  * Conecta com o banco de dados com o pattern singleton.
  * Retorna um objeto PDO!
  */
 private static function conectar()
 {
     try {
         if (self::$Connect == null) {
             $dsn = 'mysql:host=' . self::$Host . ';dbname=' . self::$Dbsa;
             $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8');
             self::$Connect = new PDO($dsn, self::$User, self::$Pass, $options);
         }
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     self::$Connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return self::$Connect;
 }
开发者ID:Giselly,项目名称:GPDev,代码行数:18,代码来源:Conn.class.php


示例17: getNumUsers

 public function getNumUsers()
 {
     try {
         include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
         $sql = "SELECT count(UID) AS numUsers FROM User WHERE CID = :CID";
         $stmt = Conn::get()->prepare($sql);
         $stmt->bindParam(":CID", $this->CID, PDO::PARAM_INT);
         $stmt->execute();
         return $stmt->fetch()["numUsers"];
     } catch (Exception $e) {
         include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/Helpers/ErrorReport.php";
         ErrorReport::send($_SERVER["SCRIPT_NAME"], $e->getMessage(), $_SERVER['REMOTE_ADDR'], true);
         return -1;
     }
 }
开发者ID:elmo911,项目名称:WolfeSolutions,代码行数:15,代码来源:Company.php


示例18: Conectar

 /**
  * Conecta com o banco de dados com o pattern singleton.
  * Retorna um objeto PDO!
  */
 private static function Conectar()
 {
     try {
         if (self::$Connect == null) {
             $dsn = 'mysql:host=' . self::$Host . ';dbname=' . self::$Dbsa;
             $options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES latin1'];
             self::$Connect = new PDO($dsn, self::$User, self::$Pass, $options);
         }
     } catch (PDOException $e) {
         PHPErro($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
         die;
     }
     self::$Connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return self::$Connect;
 }
开发者ID:Aberos,项目名称:OTPANEL,代码行数:19,代码来源:Conn.class.php


示例19: ConnectDB

 /**
  * Connects to the database using Singleton.
  * Returns a PDO object.
  */
 private static function ConnectDB()
 {
     try {
         if (self::$Connect == null) {
             //dsn define qual o DB a ser usado. No caso estamos usando o MySQL.
             $dsn = 'mysql:host=' . self::$Host . ';dbname=' . self::$Dbsa;
             $options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
             self::$Connect = new PDO($dsn, self::$User, self::$Pass, $options);
         }
     } catch (PDOException $e) {
         PHPError($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
         die;
     }
     self::$Connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return self::$Connect;
 }
开发者ID:arthurleon,项目名称:ytradio,代码行数:20,代码来源:Conn.class.php


示例20: addTicket

 /**
  * @param $ticket Ticket
  * @return Ledger
  */
 public static function addTicket($ticket)
 {
     include_once $_SERVER['DOCUMENT_ROOT'] . "/bossflex/DB/Conn.php";
     $db = Conn::get();
     $sql = "INSERT INTO Ledger (AccountNum, TicketNum, Amount, Detail) VALUES (?, ?, ?, ?)";
     $stmt = $db->prepare($sql);
     $stmt->execute(array($ticket->getAccountNum(), $ticket->getTicketNum(), $ticket->getAmount(), $ticket->getDescription()));
     $depID = $db->lastInsertId();
     $sql = "SELECT * FROM Ledger WHERE TransID = :id";
     $stmt = Conn::get()->prepare($sql);
     $stmt->bindParam(":id", $depID, PDO::PARAM_INT);
     $stmt->execute();
     $trans = $stmt->fetchObject(__CLASS__);
     Ledger::recordTransaction($trans);
     return $trans;
 }
开发者ID:elmo911,项目名称:WolfeSolutions,代码行数:20,代码来源:Ledger.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Connect类代码示例发布时间:2022-05-23
下一篇:
PHP Configure类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap