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

[讨论/交流] 如何知道CI数据库操作语句状态

[复制链接]
发表于 2011-8-23 07:03:58 | 显示全部楼层 |阅读模式
PHP复制代码
$data = array(
                'site_name' => $this->input->post('site_name'),
                'keywords' => $this->input->post('keywords'),
                'title_keywords' => $this->input->post('title_keywords'),
                'copyright' => $this->input->post('copyright'),
                'descript' => $this->input->post('descript'),
                'telephone' => $this->input->post('telephone'),
                'cell_phone' => $this->input->post('cell_phone'),
                'email' => $this->input->post('email')
                );
               
                $this->db->update('options', $data, 'id = 1');
 
复制代码




我如何判断 $this->db->update('options', $data, 'id = 1');  语句是否操作成功?
发表于 2011-8-23 15:56:25 | 显示全部楼层
return ($this->db->affected_rows() > 0) ? TRUE : FALSE;
 楼主| 发表于 2011-8-24 04:58:28 | 显示全部楼层
小凡 发表于 2011-8-23 15:56
return ($this->db->affected_rows() > 0) ? TRUE : FALSE;

感谢您的帮助!!!
发表于 2012-8-10 16:54:22 | 显示全部楼层
学习了,,,,

本版积分规则