How do I Return the id of last entry added to database? |
[eluser]Zac G.[/eluser]
Hi, I am running the following command: Code: $this->db->set('course_id', $course_id); and I want to return the id (auto incremented) of the entry just added. Any suggestions on how to go about this? Cheers, Zac
[eluser]Chad Fulton[/eluser]
Can't go wrong using the manual, I suppose. http://ellislab.com/codeigniter/user-gui...lpers.html
[eluser]JamieBarton[/eluser]
Simply use Code: $this->db->insert_id() Assign this to an array for easier usage.
[eluser]Zac G.[/eluser]
How is it I read that page 100 times and skipped the first helper every time through?!? Thanks for a fresh pair of eyes :p |
Welcome Guest, Not a member yet? Register Sign In |