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


PHP ClassTools::pSQL方法代码示例

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


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

示例1: generateWhereList

 protected static function generateWhereList($controller, $prefix = false)
 {
     if (!($session_search = self::getSearchSession($controller))) {
         return false;
     }
     $prefix = $prefix ? $prefix . '.' : '';
     $first = true;
     foreach ($session_search as $key => $val) {
         $val = ClassTools::pSQL($val);
         if ($first) {
             $first = false;
             $search = "{$prefix}`{$key}` LIKE '%{$val}%'";
         } else {
             $search .= " AND {$prefix}`{$key}` LIKE '%{$val}%'";
         }
     }
     return $search;
 }
开发者ID:s9271,项目名称:SEW3,代码行数:18,代码来源:ClassSearch.php

示例2: sqlGetCountItems

 public static function sqlGetCountItems($controller_search = '', array $custom_where = array())
 {
     global $DB;
     $table_name = (static::$use_prefix ? static::$prefix : '') . static::$definition['table'];
     $where = '';
     if (static::$has_deleted_column) {
         $where = " WHERE `deleted` = '0'";
     }
     if (static::$is_search && $controller_search != '' && ($where_search = self::generateWhereList($controller_search))) {
         if ($where == '') {
             $where = "WHERE ";
         } else {
             $where .= " AND ";
         }
         $where .= $where_search;
     }
     if (count($custom_where) > 0) {
         if ($where == '') {
             $where = "WHERE ";
         } else {
             $where .= " AND ";
         }
         $first = true;
         foreach ($custom_where as $key => $value) {
             if ($first) {
                 $first = false;
                 $where .= "`{$key}` = '" . ClassTools::pSQL($value) . "'";
             } else {
                 $where .= " AND `{$key}` = '" . ClassTools::pSQL($value) . "'";
             }
         }
     }
     $zapytanie = "SELECT COUNT(*) as count_items\n                FROM `{$table_name}`\n                {$where}\n            ;";
     $sql = $DB->pdo_fetch($zapytanie, true);
     if (($sql === false || !is_array($sql)) && (static::$is_search && $controller_search != '' && isset($_SESSION['search'][$controller_search]))) {
         if (static::$is_search && isset($_SESSION['search'][$controller_search])) {
             $_SESSION['search'][$controller_search] = array();
         }
     }
     if (!$sql || !is_array($sql) || count($sql) < 1) {
         return false;
     }
     return $sql['count_items'];
 }
开发者ID:s9271,项目名称:SEW3,代码行数:44,代码来源:ClassModel.php

示例3: sqlGetWhenPasswordSendByPasswordKey

 protected function sqlGetWhenPasswordSendByPasswordKey($password_key)
 {
     global $DB;
     $zapytanie = "SELECT `id_user_new_password`, `date_send`, `id_user`\n                FROM `sew_user_new_password`\n                WHERE `password_key` = '" . ClassTools::pSQL($password_key) . "'\n                    AND `generated` = '0'\n            ;";
     $sql = $DB->pdo_fetch($zapytanie);
     if (!$sql || !is_array($sql) || count($sql) < 1) {
         return false;
     }
     return $sql;
 }
开发者ID:s9271,项目名称:SEW3,代码行数:10,代码来源:ClassLogin.php


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