这个部分总是钻牛角尖、总是出错、

 public function getList($pagesize=25){
         $where = '1';
         $tableName = $this->getTableName();
         if(!empty($_GET['nick_name'])){
             $where.= " and $tableName.`nick_name` like '%".$_GET['nick_name']."%'";
         }
         if(!empty($_GET['user_name'])){
             $where.= " and $tableName.`user_name` = '".$_GET['user_name']."'";
         }

         if(!empty($_GET['stime'])){
             $stime = strtotime($_GET['stime']);
             $where .= " and ($tableName.`add_time` >= '$stime')";
         }

         if(!empty($_GET['etime'])){
             $stime = strtotime($_GET['etime']);
             $where .= " and ($tableName.`add_time` <= '$etime')";
         }

         if(!empty($_GET['status'])){
             $where .= " and $tableName.`status` = ".intval($_GET['status']);
         }
         $count = $this->where($where)->count();
         $this->countNum = $count;
         $Page = new \Think\Page($count,$pagesize);
         $this->page = $Page->show();
         $limit = $Page->firstRow.','.$Page->listRows;
         $res = $this->query("select $tableName.* from $tableName where $where order by $tableName.`service_id` desc limit $limit ");
         foreach($res as &$v){
             $v['region'] = $this->getRegion($v);
         }
         return $res;
     }

兄弟,这里的where语句什么时候你才能拼接不出错啊,时间在这儿数据库之中的存储格式是varchar,所以即使是时间戳,也需要传入是字符串,所以并非如int数据查询那般不需要“”引号。

最新文章

  1. layoutSubviews 与 drawRect
  2. [.NET领域驱动设计实战系列]专题八:DDD案例:网上书店分布式消息队列和分布式缓存的实现
  3. nginx+php+flight 构建RESTFul API
  4. NoSQL数据库有哪些
  5. GPIO 配置之ODR, BSRR, BRR 详解
  6. 脚本AI与脚本引擎
  7. linux笔试
  8. 秋叶PPT-三分钟教程
  9. Python操作redis、memcache和ORM框架_Day13
  10. Oracle 数据导入导出操作 (转)
  11. 【html】使用img标签和背景图片之间的区别
  12. [lua][openresty]代码覆盖率检测的解决方式
  13. 封装的head
  14. C++标准库之string返回值研究
  15. shell编程第五天
  16. 修改String中的内容
  17. BitAdminCore框架应用篇:(五)核心套件querySuite列的定义
  18. JSON学习笔记(总结自w3school)
  19. buildroot 搭建ftpd 服务器记录
  20. IS支持解析json

热门文章

  1. PHP 文件读取 fread、fgets、fgetc、file_get_contents 与 file 函数
  2. Fragments | Android Developer
  3. JAVA&#183;多线程:线程优先级
  4. 使用 Razor 生成 HTML5 中的 data- 属性
  5. Android的消息处理机制,handler,message,looper(一)
  6. python实现批量ping IP,并将结果写入
  7. Orchard官方文档翻译(十一) 使用Tags组织文本
  8. Django中级篇之模板语言
  9. SSH Secure Shell Client的傻瓜式使用方法
  10. 学习练习 java编写西游记人物类