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


PHP DatabaseConnection::quote方法代码示例

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


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

示例1: __construct

 /**
  * Create a new collection using an uri or a pattern
  *
  * f.ex.  tag:foo, category:bar, title:*, *, user:bob
  *
  */
 public function __construct($selection, Paginator $paginator = null)
 {
     // Create a collection from a tag, category, title, user etc.
     $db = new DatabaseConnection();
     $sql = $db->quote('SELECT * FROM galleryitems');
     $count = $db->quote('SELECT COUNT(*) AS numitems FROM galleryitems');
     // If we have a paginator, make use of it
     if ($paginator) {
         $sql .= ' ' . $paginator->getSqlLimit();
     }
     // Then select the rows and the total count
     $rs = $db->getRows($sql);
     $rsc = $db->getSingleRow($count);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:20,代码来源:gallery.php

示例2: submitComment

 public function submitComment()
 {
     $conn = new DatabaseConnection();
     if (!isset($_GET['replyid'])) {
         $sentence = 'CALL addComment(' . $_SESSION['bookid'] . ',' . $_SESSION['id'] . ",'" . $_POST['comment'] . "')";
     } else {
         $sentence = 'CALL addReply(' . $_SESSION['bookid'] . ',' . $_SESSION['id'] . ',' . $conn->quote($_POST['reply']) . ',' . $_GET['replyid'] . ')';
     }
     $conn->query($sentence);
 }
开发者ID:apexJCL,项目名称:mvc,代码行数:10,代码来源:comment.php

示例3: register

 public function register($username, $city, $sex, $mail, $pass, $ver_pass)
 {
     if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
         return 'badmail';
     } else {
         if ($pass != $ver_pass) {
             return 'passdontmatch';
         } else {
             if (sizeof($username) < 1) {
                 return 'nameerror';
             } else {
                 $conn = new DatabaseConnection();
                 $username = $conn->quoteConcat($username);
                 $city = $conn->quoteConcat($city);
                 $sex = $conn->quoteConcat($sex);
                 $mail = $conn->quoteConcat($mail);
                 $pass = $conn->quote($pass);
                 $sentence = 'SELECT registro(' . $username . $city . $sex . $mail . $pass . ")";
                 $conn->singleton($sentence);
                 return 'good';
             }
         }
     }
 }
开发者ID:apexJCL,项目名称:mvc,代码行数:24,代码来源:regManager.php

示例4: getAutor

 function getAutor($idAutor)
 {
     $conn = new DatabaseConnection();
     $idAutor = $conn->quote($idAutor);
     return $conn->query('CALL datosAutor(' . $idAutor . ')');
 }
开发者ID:apexJCL,项目名称:mvc,代码行数:6,代码来源:autores.php

示例5: add

 public function add()
 {
     switch ($_GET['type']) {
         case 'book':
             $conn = new DatabaseConnection();
             // Define the upload img directory
             $upload_dir = 'view/img/books/';
             $def_book_pic = 'view/img/icon-default-book.png';
             // If there's no picture selected
             if ($_FILES['picture']['error'] == 4) {
                 if ($_POST['def_pic'] == $def_book_pic) {
                     // If the picurl is the same as that of default picurl
                     $sentence = 'CALL insertLibro(' . $_POST['id_autor'] . ',' . $_POST['id_genero'] . ',' . $_POST['id_editorial'] . ',' . $conn->quote($_POST['titulo']) . ',' . $conn->quote($_POST['fecha_publicacion']) . ',' . $conn->quote($_POST['resumen']) . ',' . $conn->quote($def_book_pic) . ')';
                 } else {
                     // Else, it means that it already has a default picture, so it keeps it
                     $sentence = 'CALL insertLibro(' . $_POST['id_autor'] . ',' . $_POST['id_genero'] . ',' . $_POST['id_editorial'] . ',' . $conn->quote($_POST['titulo']) . ',' . $conn->quote($_POST['fecha_publicacion']) . ',' . $conn->quote($_POST['resumen']) . ',' . $conn->quote($_POST['def_pic']) . ')';
                 }
             } else {
                 // Now we define the name of the file
                 $filename = $upload_dir . basename($_FILES['picture']['name']);
                 // nombre del archivo
                 // If the name of the picture is different
                 if ($filename != $_POST['def_pic']) {
                     // Erase the stored picture
                     unlink($_POST['def_pic']);
                 }
                 move_uploaded_file($_FILES['picture']['tmp_name'], $filename);
                 $sentence = 'CALL insertLibro(' . $_POST['id_autor'] . ',' . $_POST['id_genero'] . ',' . $_POST['id_editorial'] . ',' . $conn->quote($_POST['titulo']) . ',' . $conn->quote($_POST['fecha_publicacion']) . ',' . $conn->quote($_POST['resumen']) . ',' . $conn->quote($filename) . ')';
             }
             $conn->query($sentence);
             break;
         case 'author':
             $conn = new DatabaseConnection();
             // Define the upload img directory
             $upload_dir = 'view/img/authors/';
             $def_user_pic = 'view/img/authors/icon-user-default.png';
             // If no file is selected
             if ($_FILES['picture']['error'] == 4) {
                 if ($_POST['def_pic'] == $def_user_pic) {
                     $sentence = 'INSERT INTO autor (nombre_autor, pais_autor, seudonimo, biografia, picurl) VALUE (' . $conn->quote($_POST['nombre_autor']) . ',' . $conn->quote($_POST['pais_autor']) . ',' . $conn->quote($_POST['seudonimo']) . ',' . $conn->quote($_POST['biografia']) . ',' . $conn->quote($def_user_pic) . ')';
                 } else {
                     $sentence = 'INSERT INTO autor (nombre_autor, pais_autor, seudonimo, biografia, picurl) VALUE (' . $conn->quote($_POST['nombre_autor']) . ',' . $conn->quote($_POST['pais_autor']) . ',' . $conn->quote($_POST['seudonimo']) . ',' . $conn->quote($_POST['biografia']) . ',' . $conn->quote($_POST['def_pic']) . ')';
                 }
             } else {
                 // Now we define the name of the file
                 $filename = $upload_dir . basename($_FILES['picture']['name']);
                 // Name of the file
                 $sentence = 'INSERT INTO autor (nombre_autor, pais_autor, seudonimo, biografia, picurl) VALUE (' . $conn->quote($_POST['nombre_autor']) . ',' . $conn->quote($_POST['pais_autor']) . ',' . $conn->quote($_POST['seudonimo']) . ',' . $conn->quote($_POST['biografia']) . ',' . $conn->quote($filename) . ')';
                 move_uploaded_file($_FILES['picture']['tmp_name'], $filename);
             }
             $conn->query($sentence);
             break;
         case 'editorial':
             $conn = new DatabaseConnection();
             $sentence = 'INSERT INTO editorial (nombre_editorial, pais_editorial, fundador, fundacion) VALUE (' . $conn->quoteConcat($_POST['nombre_editorial']) . $conn->quoteConcat($_POST['pais_editorial']) . $conn->quoteConcat($_POST['fundador']) . $_POST['fundacion'] . ')';
             $conn->query($sentence);
             break;
         case 'genre':
             $conn = new DatabaseConnection();
             $conn->query('INSERT INTO genero (descripcion_genero) VALUE (' . $conn->quote($_POST['descripcion_genero']) . ')');
             break;
         case 'reader':
             $conn = new DatabaseConnection();
             // Define the upload img directory
             $upload_dir = 'view/img/users/';
             $def_user_pic = 'view/img/icon-user-default.png';
             // If there's no picture selected
             if ($_FILES['picture']['error'] == 4) {
                 $sentence = 'CALL agregaUsuario(' . $conn->quote($_POST['nombre_lector']) . ',' . $conn->quote($_POST['ciudad_lector']) . ',' . $conn->quote($_POST['sexo']) . ',' . $conn->quote($_POST['email']) . ',' . $conn->quote($_POST['password']) . ',' . $conn->quote($_POST['def_pic']) . ',' . $_POST['id_tipo_usuario'] . ')';
             } else {
                 // Now we define the name of the file
                 $filename = $upload_dir . $_SESSION['id_lector'] . '.' . pathinfo($_FILES['picture']['name'], PATHINFO_EXTENSION);
                 // nombre del archivo
                 // If the name of the picture is different
                 if ($filename != $_POST['def_pic'] && $_POST['def_pic'] != $def_user_pic) {
                     // Erase the stored picture
                     unlink($_POST['def_pic']);
                 }
                 move_uploaded_file($_FILES['picture']['tmp_name'], $filename);
                 $sentence = 'CALL agregaUsuario(' . $conn->quote($_POST['nombre_lector']) . ',' . $conn->quote($_POST['ciudad_lector']) . ',' . $conn->quote($_POST['sexo']) . ',' . $conn->quote($_POST['email']) . ',' . $conn->quote($_POST['password']) . ',' . $conn->quote($filename) . ',' . $_POST['id_tipo_usuario'] . ')';
             }
             $conn->query($sentence);
             break;
     }
 }
开发者ID:apexJCL,项目名称:mvc,代码行数:85,代码来源:management.php

示例6: quote

 public function quote($string, $parameter_type = \PDO::PARAM_STR)
 {
     return $this->connection->quote($string, $parameter_type);
 }
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:4,代码来源:Connection.php

示例7: logout

 function logout()
 {
     $conn = new DatabaseConnection();
     $conn->singleton('SELECT logout(' . $conn->quote($_SESSION['mail']) . ')');
 }
开发者ID:apexJCL,项目名称:mvc,代码行数:5,代码来源:logManager.php

示例8: geoLocationInsertBatch

 private function geoLocationInsertBatch($batch)
 {
     $db = new DatabaseConnection();
     $sql = 'REPLACE INTO geonames VALUES ';
     $rowdata = array();
     foreach ($batch as $row) {
         foreach ($row as $id => $data) {
             $row[$id] = $db->quote($data);
         }
         $rowdata[] = "(" . join(",", $row) . ")";
     }
     $this->records += count($rowdata);
     $sql .= join(',', $rowdata);
     try {
         $db->exec($sql);
     } catch (Exception $e) {
         echo $e;
         die;
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:20,代码来源:geonames.php

示例9: searchBook

 public function searchBook($searchstring)
 {
     $conn = new DatabaseConnection();
     $searchstring = $conn->quote('.*' . $searchstring . '.*');
     return $conn->query('CALL searchBook(' . $searchstring . ')');
 }
开发者ID:apexJCL,项目名称:mvc,代码行数:6,代码来源:search.php


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