出现一个问题

浏览:216 发布日期:2017/08/26 分类:求助交流
1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1 [ SQL语句 ] : SELECT COUNT(*) AS tp_count FROM `xwzx1` WHERE ( c_id= ) LIMIT 1

我在执行修改成功的时候,传递了一个id过去,为什么还是报错呢?
$this->success('修改成功',U('index/xwzxlr','id='.$c_id));die;


跳转后执行的是这个方法,搜索数据并且分类显示//新闻中心内容查询
    public function xwzxlr(){
        $class = M('xwzx1');
        $id = I('id');
        //dump($id);
        
        
        //if(!empty($id)){
            
        //}else{
        //    $count      = $class->count();// 查询满足要求的总记录数
        //    $list = $class->limit($Page->firstRow.','.$Page->listRows)->select();
        //}
        $count      = $class->where('c_id='.$id)->count();// 查询满足要求的总记录数
        $Page       = new \Think\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show       = $Page->show();// 分页显示输出// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
        
        
        $list = $class->where('c_id='.$id)->limit($Page->firstRow.','.$Page->listRows)->select();
        
        //echo $count;
        $sql = $class->getLastSql();
        //echo $sql;
        $this->assign('list',$list);// 赋值数据集
        $this->assign('page',$show);// 赋值分页输出
        $this->display(); // 输出模板
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>