sunjava 发表于 2013-1-4 16:59:36

$this->db->insert_id() 该如何用?

请问我使用 codeIgniter ,那 $this->db->insert_id(); 该如何使用?

我这样用有错误吗?
$this->db->insert('test',$Data_);
$Qdb=$this->db->insert_id();

但我 echo $Qdb ; 是空的?

diy66 发表于 2013-1-4 17:01:30

$this->db->insert_id();
最后一条插入的数据id

如果是空的,请查看数据库中的是否有数据。

sunjava 发表于 2013-1-4 17:05:11

你好,我资料库的确有资料。
是否我那错了呢?

可以给范例吗?

jeongee 发表于 2013-1-4 18:09:24

表里要有auto_increase类型的primary key

ichou 发表于 2013-1-5 00:17:23

@jeongee正解
页: [1]
查看完整版本: $this->db->insert_id() 该如何用?