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


PHP DataObject::disconnect方法代码示例

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


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

示例1: deleteAllForMember

 public static function deleteAllForMember($memberId)
 {
     $conn = parent::connect();
     $sql = "DELETE FROM " . TBL_ACCESS_LOG . " WHERE memberId = :memberId";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":memberId", $memberId, PDO::PARAM_INT);
         $st->execute();
         parent::disconnect($conn);
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:raynaldmo,项目名称:php-education,代码行数:14,代码来源:LogEntry.class.php

示例2: insert

 public function insert()
 {
     $conn = parent::connect();
     $sql = "INSERT INTO factura (id_pedido, precio) \nVALUES (:id_pedido, :precio);";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":id_pedido", $this->data["id_pedido"], PDO::PARAM_INT);
         $st->bindValue(":precio", $this->data["precio"], PDO::PARAM_STR);
         $st->execute();
         parent::disconnect($conn);
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:15,代码来源:Factura.class.php

示例3: insert

 public function insert()
 {
     $conn = parent::connect();
     $sql = "INSERT INTO pedido_menu (id_menu, id_pedido, id_decoracion) \nVALUES (:id_menu, :id_pedido, :id_decoracion);";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":id_menu", $this->data["id_menu"], PDO::PARAM_INT);
         $st->bindValue(":id_pedido", $this->data["id_pedido"], PDO::PARAM_INT);
         $st->bindValue(":id_decoracion", $this->data["id_decoracion"], PDO::PARAM_INT);
         $st->execute();
         parent::disconnect($conn);
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:16,代码来源:Pedidos_menu.class.php

示例4: getMember

  public static function getMember( $id ) {
    $conn = parent::connect();
    $sql = "SELECT * FROM " . TBL_MEMBERS . " WHERE id = :id";

    try {
      $st = $conn->prepare( $sql );
      $st->bindValue( ":id", $id, PDO::PARAM_INT );
      $st->execute();
      $row = $st->fetch();
      parent::disconnect( $conn );
      if ( $row ) return new Member( $row );
    } catch ( PDOException $e ) {
      parent::disconnect( $conn );
      die( "Query failed: " . $e->getMessage() );
    }
  }
开发者ID:hoiwanjohnlouis,项目名称:eclipsePrototyping,代码行数:16,代码来源:Member.class.php

示例5: getPrecio

 public static function getPrecio($id_menu)
 {
     $conn = parent::connect();
     $sql = "SELECT nombre, precio FROM menu  WHERE id_menu = :id_menu";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":id_menu", $id_menu, PDO::PARAM_INT);
         $st->execute();
         $row = $st->fetch();
         parent::disconnect($conn);
         if ($row) {
             return new Menu($row);
         }
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:18,代码来源:Menu.class.php

示例6: getById

 public static function getById($id_bebida)
 {
     $conn = parent::connect();
     $sql = "SELECT * FROM bebidas  WHERE id_bebida = :id_bebida";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":id_bebida", $id_bebida, PDO::PARAM_STR);
         $st->execute();
         $row = $st->fetch();
         parent::disconnect($conn);
         if ($row) {
             return new Bebida($row);
         }
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:18,代码来源:Bebida.class.php

示例7: insert

 public function insert()
 {
     $conn = parent::connect();
     $sql = "INSERT INTO cliente (email, pass, nombre, apellidos, telefono) \n           VALUES (:email, SHA(:pass), :nombre, :apellidos, :telefono)";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":email", $this->data["email"], PDO::PARAM_STR);
         $st->bindValue(":pass", $this->data["pass"], PDO::PARAM_STR);
         $st->bindValue(":nombre", $this->data["nombre"], PDO::PARAM_STR);
         $st->bindValue(":apellidos", $this->data["apellidos"], PDO::PARAM_STR);
         $st->bindValue(":telefono", $this->data["telefono"], PDO::PARAM_STR);
         $st->execute();
         parent::disconnect($conn);
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:18,代码来源:Cliente.class.php

示例8: getById

 public static function getById($id_decoracion)
 {
     $conn = parent::connect();
     $sql = "SELECT * FROM decoracion  WHERE id_decoracion = :id_decoracion";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":id_decoracion", $id_decoracion, PDO::PARAM_INT);
         $st->execute();
         $row = $st->fetch();
         parent::disconnect($conn);
         if ($row) {
             return new Decoracion($row);
         }
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:18,代码来源:Decoracion.class.php

示例9: authenticate

 public static function authenticate(array $data)
 {
     $pdo = parent::connect();
     if ($data['email'] != '') {
         $attr = 'email';
     } elseif ($data['username'] != '') {
         $attr = 'username';
     }
     $pass = hash_hmac('SHA256', $data['pass'], User::SALT);
     $table = TBL_USERS;
     $q = "SELECT id, username, userType, email, pass, dateAdded FROM {$table} WHERE {$attr}=:attr AND pass=:pass";
     $stmt = $pdo->prepare($q);
     $stmt->execute(array(':attr' => $data[$attr], ':pass' => $pass));
     $row = $stmt->fetch(PDO::FETCH_ASSOC);
     parent::disconnect($pdo);
     if ($row) {
         return new User($row);
     }
 }
开发者ID:herrder,项目名称:mybootstrapedcms,代码行数:19,代码来源:User.php

示例10: getBebidas

 public static function getBebidas()
 {
     $conn = parent::connect();
     $sql = "SELECT * FROM tipos_bebidas;";
     try {
         $st = $conn->prepare($sql);
         $st->execute();
         $tipos = array();
         foreach ($st->fetchAll() as $row) {
             $tipos[] = new Tipo($row);
         }
         $row = $st->fetch();
         parent::disconnect($conn);
         return array($tipos);
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:NARTONIC,项目名称:tuchefacasa,代码行数:19,代码来源:Tipos.class.php

示例11: getLogEntries

 public static function getLogEntries($memberId)
 {
     $conn = parent::connect();
     $sql = "SELECT * FROM " . TBL_ACCESS_LOG . " WHERE memberId = :memberId ORDER BY lastAccess DESC";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":memberId", $memberId, PDO::PARAM_INT);
         $st->execute();
         $logEntries = array();
         foreach ($st->fetchAll() as $row) {
             $logEntries[] = new LogEntry($row);
         }
         parent::disconnect($conn);
         return $logEntries;
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:raynaldmo,项目名称:php-education,代码行数:19,代码来源:LogEntry.class.php

示例12: record

 public function record()
 {
     $conn = parent::connect();
     $sql = "SELECT * FROM " . TBL_MESSAGE . " ";
     $sql .= "WHERE member_id = :member_id and message_text = :message_text and subject = :subject";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":member_id", $this->data["member_id"], PDO::PARAM_INT);
         $st->bindValue(":message_text", $this->data["message_text"], PDO::PARAM_STR);
         $st->bindValue(":subject", $this->data["subject"], PDO::PARAM_STR);
         $st->execute();
         //  var_dump($sql, $this->data, $st);
         if ($st->fetch()) {
             $sql = "UPDATE " . TBL_MESSAGE . " SET num_access = num_access + 1 ";
             $sql .= "WHERE member_id = :member_id and message_text = :message_text and subject = :subject";
             $st = $conn->prepare($sql);
             $st->bindValue(":member_id", $this->data["member_id"], PDO::PARAM_INT);
             $st->bindValue(":message_text", $this->data["message_text"], PDO::PARAM_STR);
             $st->bindValue(":subject", $this->data["subject"], PDO::PARAM_STR);
             //  var_dump($sql, $st);
             $st->execute();
         } else {
             $sql = "INSERT INTO " . TBL_MESSAGE . " ( member_id, message_text, num_access, subject ) ";
             $sql .= " VALUES ( :member_id, :message_text, 1, :subject )";
             $st = $conn->prepare($sql);
             $st->bindValue(":member_id", $this->data["member_id"], PDO::PARAM_INT);
             $st->bindValue(":message_text", $this->data["message_text"], PDO::PARAM_STR);
             $st->bindValue(":subject", $this->data["subject"], PDO::PARAM_STR);
             //  var_dump($sql, $st);
             $st->execute();
         }
         //  var_dump($sql, $st);
         parent::disconnect($conn);
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:hoiwanjohnlouis,项目名称:eclipsePrototyping,代码行数:38,代码来源:Message.class.php

示例13: getNewsSources

 public function getNewsSources()
 {
     $connection = parent::connect();
     $selectSQL = "SELECT * FROM NEWSSOURCE";
     $rows = $connection->query($selectSQL);
     $newssources = array();
     foreach ($rows as $row) {
         $newsSource = new NewsSource();
         $newsSource->setNewsSourceId($row[0]);
         $newsSource->setNewsSourceName($row[1]);
         $newsSource->setNewsSourceLink($row[2]);
         $newsSource->setNewsSourceLinkType($row[3]);
         $newssources[] = $newsSource;
     }
     parent::disconnect($connection);
     return $newssources;
 }
开发者ID:bhagvank,项目名称:nuntium,代码行数:17,代码来源:NewsSourcePDO.php

示例14: getUsers

 public function getUsers()
 {
     $connection = parent::connect();
     $selectSQL = "SELECT * FROM USER";
     $rows = $connection->query($selectSQL);
     $users = array();
     foreach ($rows as $row) {
         $user = new User();
         $user->setUserId($row[0]);
         $user->setUserName($row[1]);
         $user->setPassword($row[2]);
         $users[] = $user;
     }
     parent::disconnect($connection);
     return $users;
 }
开发者ID:bhagvank,项目名称:nuntium,代码行数:16,代码来源:UserPDO.php

示例15: authenticate

 public function authenticate()
 {
     $conn = parent::connect();
     $sql = "SELECT * FROM " . TBL_MEMBERS . " WHERE username = :username AND password = password(:password)";
     try {
         $st = $conn->prepare($sql);
         $st->bindValue(":username", $this->data["username"], PDO::PARAM_STR);
         $st->bindValue(":password", $this->data["password"], PDO::PARAM_STR);
         $st->execute();
         $row = $st->fetch();
         parent::disconnect($conn);
         if ($row) {
             return new Member($row);
         }
     } catch (PDOException $e) {
         parent::disconnect($conn);
         die("Query failed: " . $e->getMessage());
     }
 }
开发者ID:raynaldmo,项目名称:php-education,代码行数:19,代码来源:Member.class.php


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