用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1417|回复: 1
收起左侧

[HELP] 新闻发布系统 如何每点击一个新闻变自加一

[复制链接]
发表于 2013-12-13 05:52:57 | 显示全部楼层 |阅读模式
        function news_selectid($nid)
        {
                $cid=$this->input->get('cid');
                $this->db->select('*');
                $this->db->where('nid',$nid);
                $result=$this->db->get('news')->result_array();
                $data = array('cid' => $cid+1);
                $where = " nid = $nid";
                if($result)
                {
                        return $result[0];
                        $this->db->update_string('cid',$data,$where);
                }
                else
                {
                        return false;
                }
        }

nid为新闻id cid为点击次数
没有报错也没有任何的数据更新。每次查询后数据库中cid并不会增加1
该如何解决?
发表于 2013-12-13 10:19:34 | 显示全部楼层
->where('cid', 'cid+1', false);

本版积分规则