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

$this->db->insert('user');怎么取插入数据的自增ID值

[复制链接]
发表于 2012-12-6 19:55:08 | 显示全部楼层 |阅读模式
请问调用 $this->db->insert('user'); 此方法,进行插入操作后,怎样可以得到此记录的自增ID。
发表于 2012-12-6 21:09:09 | 显示全部楼层
$this->db->insert_id(); 试试。
发表于 2012-12-7 18:37:14 | 显示全部楼层
 楼主| 发表于 2012-12-10 16:00:42 | 显示全部楼层
lxylxy888666 发表于 2012-12-6 21:09
$this->db->insert_id(); 试试。

哈哈,谢谢了.
 楼主| 发表于 2012-12-10 16:01:06 | 显示全部楼层
ichou 发表于 2012-12-7 18:37
http://codeigniter.org.cn/user_guide/database/helpers.html

谢谢了
发表于 2012-12-26 14:36:16 | 显示全部楼层
其实我认为insert方法应该给一个返回值是创建好的对象比较合理

本版积分规则