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


PHP DatabaseConnection::quoteConcat方法代码示例

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


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

示例1: 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

示例2: 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


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