CodeIgniter Forums
getting the auto_inc id of the mysql insert - 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: getting the auto_inc id of the mysql insert (/showthread.php?tid=11577)



getting the auto_inc id of the mysql insert - El Forum - 09-14-2008

[eluser]Fenix[/eluser]
I am trying to insert blog entry-type data into a database but I keep the tags in a separate table. The post table has an auto incremented id field which needs to also be the the value of a field in the tags table. I saw there was a way to do this a while ago but I can't remember where I found it. Any help is appreciated, thank you!


getting the auto_inc id of the mysql insert - El Forum - 09-14-2008

[eluser]Mirage[/eluser]
Code:
$this->db->insert_id()

Hint: The user guide contains a wealth of info. Confusedmirk:

Cheers,
-m