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


PHP bd::prepare方法代碼示例

本文整理匯總了PHP中bd::prepare方法的典型用法代碼示例。如果您正苦於以下問題:PHP bd::prepare方法的具體用法?PHP bd::prepare怎麽用?PHP bd::prepare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bd的用法示例。


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

示例1: update

 public function update($package)
 {
     $con = new bd();
     $sql = "UPDATE package SET id_city=" . $package->getIdCity() . ", name='" . $package->getName() . "', " . "description='" . $package->getDescription() . "', price=" . $package->getPrice() . ", " . "price_promo=" . $package->getPricePromo() . ", date_start='" . $package->getDateStart() . "', date_end='" . $package->getDateEnd() . "', " . "id_user=" . $package->getIdUser() . ", thumbnail='" . $package->getThumbnail() . "' WHERE idpackage=" . $package->getIdPackage();
     $r = $con->prepare($sql);
     $r->execute();
 }
開發者ID:rafael11690,項目名稱:topicos2,代碼行數:7,代碼來源:packageDAO.php

示例2: subir

 public function subir($ar, $ex, $dir)
 {
     $this->dir = $dir;
     $this->archivo = explode(".", $ar['name']);
     $this->extensiones = $ex;
     $random = date("d:m:y:h:i") * rand() * 9999999;
     if (in_array($this->archivo[1], $this->extensiones)) {
         $this->url = $dir . $random . "." . $this->archivo[1];
         if (!file_exists($this->dir)) {
             @mkdir($this->dir, 777);
         }
         $this->arr = array(':nombre' => "hola", ':des' => "Hola", ':url' => $this->url);
         $this->archivo = $ar;
         if (move_uploaded_file($this->archivo['tmp_name'], $this->url)) {
             $base = new bd(TBD, SER, BD, US, CL);
             $i = 1;
             $sql = $base->prepare("INSERT INTO imagen(idimagen, nombre, ruta, foto) VALUES ({$i}+1, {$this->archivo}[1], {$this->url}, {$this->archivo}['tmp_name'])");
             if ($sql->execute($this->arr)) {
                 echo "Imagen subida y almacenada correctamente";
             } else {
                 echo "Error";
             }
         } else {
             echo "error";
         }
     } else {
         echo "Extension invalida";
     }
 }
開發者ID:edigiarch,項目名稱:sisregcivil,代碼行數:29,代碼來源:clase_imagen.php

示例3: insert

 public function insert($city)
 {
     $con = new bd();
     $sql = 'INSERT INTO city (name, state, country, description, thumbnail, id_gallery, id_user) VALUES ' . '("' . $city->getName() . '", "' . $city->getState() . '", ' . '"' . $city->getCountry() . '", "' . $city->getDescription() . '", ' . '"' . $city->getThumbnail() . '", ' . $city->getIdGallery() . ', ' . $city->getIdUser() . ')';
     $r = $con->prepare($sql);
     $r->execute();
 }
開發者ID:rafael11690,項目名稱:topicos2,代碼行數:7,代碼來源:cityDAO.php

示例4: insert

 public function insert($form)
 {
     $con = new bd();
     $sql = "INSERT INTO form_interest (id_package, first_name, last_name, guests_number, couple_room, individual_room, double_room, triple_room, observation, email, area_code, phone, newsletter) VALUES " . "(" . $form->getIdPackage() . ", '" . $form->getFirstName() . "', " . "'" . $form->getLastName() . "', " . $form->getGuestsNumber() . ", " . $form->getCoupleRoom() . ", " . $form->getIndividualRoom() . ", " . $form->getDoubleRoom() . ", " . $form->getTripleRoom() . ", '" . $form->getObservation() . "', '" . $form->getEmail() . "', " . $form->getAreaCode() . ", " . $form->getPhone() . ", " . $form->getNewsletter() . ")";
     $r = $con->prepare($sql);
     $r->execute();
 }
開發者ID:rafael11690,項目名稱:topicos2,代碼行數:7,代碼來源:formDAO.php

示例5: getUser

 public function getUser($login, $password)
 {
     $con = new bd();
     $sql = 'Select * from user where login="' . $login . '" AND password = MD5("' . $password . '")';
     $r = $con->prepare($sql);
     $r->execute();
     $result = $r->fetch();
     $user = new user($result['iduser'], $result['login'], $result['password'], $result['name'], $result['privilege']);
     return $user;
 }
開發者ID:rafael11690,項目名稱:topicos2,代碼行數:10,代碼來源:userDAO.php

示例6: getLastPublishedTime

 public function getLastPublishedTime($uid, $sn)
 {
     $db = new bd();
     $statement = $db->prepare("SELECT * FROM manager_stats WHERE userid=? AND social_network=? ORDER BY time DESC LIMIT 1");
     if ($statement->execute(array($uid, $sn))) {
         $fetch = $statement->fetchAll();
         return $fetch[0]["time"];
     } else {
         return false;
     }
 }
開發者ID:darwinv,項目名稱:sambilnew,代碼行數:11,代碼來源:usuarios.php

示例7: buscarAmigos2

 public function buscarAmigos2($id, $tipo = NULL, $busqueda = NULL)
 {
     $bd = new bd();
     $querynatural = "SELECT ua.usuarios_id numero, seudonimo, CONCAT(nombre,' ', apellido) nombre, estados_id estado\n\t\t\t\t\t\t  FROM usuarios_naturales un, usuarios_accesos ua, usuarios u \n\t\t\t\t\t\t  WHERE u.id = un.usuarios_id AND u.id = ua.usuarios_id ";
     $queryjuridico = "SELECT ua.usuarios_id numero, seudonimo, razon_social nombre, estados_id estado \n\t\t\t\t\t\t  FROM usuarios_juridicos uj, usuarios_accesos ua, usuarios u  \n\t\t\t\t\t\t  WHERE  u.id = uj.usuarios_id AND u.id = ua.usuarios_id ";
     $estado = "";
     $union = "";
     $search = "";
     if (!is_null($tipo)) {
         if ($tipo == "jur") {
             $querynatural = "";
         } elseif ($tipo == "nat") {
             $queryjuridico = "";
         } elseif ($tipo == "all") {
             $union = " UNION ALL ";
         } elseif (is_numeric($tipo)) {
             $estado = " AND estado = {$tipo} ";
             $union = " UNION ALL ";
         }
     } else {
         $union = " UNION ALL ";
     }
     if (!empty($busqueda)) {
         $search = " AND (nombre LIKE '%{$busqueda}%' OR seudonimo LIKE '%{$busqueda}%')";
     }
     $statement = "SELECT numero, seudonimo, nombre, estado \n\t\t\t\t\t  FROM ({$querynatural}\n\t\t\t\t\t\t  {$union}\n\t\t\t\t\t\t  {$queryjuridico}) tabla, usuarios_amigos \n\t\t\t\t\t  WHERE usuarios_id = numero {$estado} {$search}  ";
     die($statement);
     try {
         $sql = $bd->prepare($statement);
         $sql->execute(array($id));
         if ($sql->rowCount() > 0) {
             return $sql->fetchAll();
         } else {
             return false;
         }
     } catch (PDOException $ex) {
         return $bd->showError($ex);
     }
 }
開發者ID:darwinv,項目名稱:sambilnew,代碼行數:39,代碼來源:amigos.php

示例8: getLastPublishedTime

 public function getLastPublishedTime($id, $sn)
 {
     $db = new bd();
     $statement = $db->prepare("SELECT * FROM manager_stats WHERE userid=:uid AND sn=':sn' ORDER BY time DESC LIMIT 1");
     $statement->bindParam(':uid', $uid);
     $statement->bindParam(':sn', $sn);
     $statement->execute();
     $fetch = $statement->fetchAll();
     return $fetch[0]["time"];
 }
開發者ID:darwinv,項目名稱:sambilnew,代碼行數:10,代碼來源:usuarios-old.php


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