CodeIgniter Forums
Question about insert_id() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Question about insert_id() (/showthread.php?tid=56745)



Question about insert_id() - El Forum - 01-16-2013

[eluser]cPage[/eluser]
Is that right to get the last insert id by specifying the key , because i dont get any error when i do this :

Code:
$this->db->insert_id('id_customer');




Question about insert_id() - El Forum - 01-16-2013

[eluser]CroNiX[/eluser]
It won't have any affect at all and is ignored. $db::insert_id() will return the last inserted ID made on that db connection regardless of key and is no different than just returning last_insert_id directly from mysql or whatever driver you're using (which is what it's doing)


Question about insert_id() - El Forum - 01-16-2013

[eluser]cPage[/eluser]
thanks


Question about insert_id() - El Forum - 02-06-2013

[eluser]p5systems[/eluser]
Hi,

This will work

$this->db->insert_id();