当前位置: 首页>>代码示例>>PHP>>正文


PHP Connect::getInstance方法代码示例

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


在下文中一共展示了Connect::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insert

 public function insert($obj)
 {
     try {
         $query = "INSERT INTO portalleg." . $this->table . " (\n                name,\n                login,\n                mail,\n                pass,\n                type,\n                photo,\n            ) VALUES (\n                :name,\n                :login,\n                :mail,\n                :pass,\n                :type,\n                :photo\n            )";
         $sql = Connect::getInstance()->prepare($query);
         $sql->bindValue(':name', $obj->getName(), PDO::PARAM_STR);
         $sql->bindValue(':login', $obj->getLogin(), PDO::PARAM_STR);
         $sql->bindValue(':mail', $obj->getMail(), PDO::PARAM_STR);
         $sql->bindValue(':pass', $obj->getPass(), PDO::PARAM_STR);
         $sql->bindValue(':type', $obj->getType(), PDO::PARAM_INT);
         $sql->bindValue(':photo', $obj->getPhoto(), PDO::PARAM_STR);
         return $sql->execute();
     } catch (Exception $e) {
         Lib::warning($e);
     }
 }
开发者ID:dnielrodrigues,项目名称:cristal,代码行数:16,代码来源:CristalUserDao.php

示例2: __construct

 public function __construct()
 {
     self::$Connect = Connect::getInstance(DB_NAME, DB_HOST, DB_USER, DB_PASS);
     $this->query = isset($this->query) ? $this->query : null;
 }
开发者ID:nicoavn,项目名称:GreenJobs,代码行数:5,代码来源:QueryManager.php

示例3: delete_common

 public function delete_common($table, $filters, $query_extra)
 {
     //criando o objeto pdo...
     $pdo = parent::getInstance();
     //filtros
     foreach ($filters as $key => $value) {
         $filters_delete = "{$key}=:{$key} AND ";
     }
     //removendo ultimo "AND";
     $filters_delete = substr($filters_delete, 0, -4);
     //preparando query apartir dos campos($fields) e os parametros de valores nomeados($values)
     $query = "DELETE FROM {$table} WHERE {$filters_delete};";
     //se a consulta precisar de algo mais..
     if ($query_extra != "") {
         $query .= $query_extra;
     }
     //echo $query,'<br>';
     //continuação da preparação da query...
     $statement = $pdo->prepare($query);
     if (!$statement) {
         echo "\\PDO::errorInfo():\n";
         print_r($dbh->errorInfo());
     }
     //substituindo os parametros dos filtros nomeados pelos verdadeiros valores, ex: ":name" por "Alessandro"
     foreach ($filters as $key => $value) {
         //$parameters[":$key"] = $value;
         $statement->bindValue(":{$key}", $value, PDO::PARAM_STR);
     }
     //$statement->debugDumpParams();
     //executando a query já com seus valores
     if ($statement->execute()) {
         //se der certo retorna true...
         return true;
     } else {
         //se não der certo, retornará false...
         return false;
     }
 }
开发者ID:mvnp,项目名称:PHPeste_minicurso,代码行数:38,代码来源:Manager.class.php

示例4: __construct

 public function __construct($dbarr = array())
 {
     $this->connect = Connect::getInstance($dbarr);
 }
开发者ID:tiger2soft,项目名称:LycPHP,代码行数:4,代码来源:Manager.class.php

示例5: __construct

 function __construct()
 {
     $this->db = Connect::getInstance();
 }
开发者ID:Zenya3000,项目名称:GNS,代码行数:4,代码来源:Model.php

示例6: find

 public function find($value, $by)
 {
     try {
         $sql = "SELECT * FROM " . $this->table . " WHERE " . $by . " = :value";
         $sql = Connect::getInstance()->prepare($sql);
         $sql->bindValue(":value", $value);
         $sql->execute();
         return $sql->fetch(PDO::FETCH_ASSOC);
     } catch (Exception $e) {
         Lib::dbWarning($e);
         die;
     }
 }
开发者ID:dnielrodrigues,项目名称:cristal,代码行数:13,代码来源:MainDao.php


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