CodeIgniter Forums
Return Row ID when inserting - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Return Row ID when inserting (/thread-12375.html)



Return Row ID when inserting - El Forum - 10-16-2008

[eluser]domfosnz[/eluser]
Is there any way of accessing the Row Id of a freshly inserted record.

Once I have inserted a record I need to insert several child records in a separate table with the parent records ID.

Thanks


Return Row ID when inserting - El Forum - 10-16-2008

[eluser]Jelmer[/eluser]
$this->db->insert_id()

Take a look at http://ellislab.com/codeigniter/user-guide/database/helpers.html for more helpfull functions.


Return Row ID when inserting - El Forum - 10-16-2008

[eluser]domfosnz[/eluser]
Thanks Smile