Getting the last query's 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: Getting the last query's insert_id (/showthread.php?tid=2621) |
Getting the last query's insert_id - El Forum - 08-15-2007 [eluser]Kemik[/eluser] Hello all, I've created a form which allows the user to create a team. When the form is submitted it will create the team, however I also need to insert a second query but this time in to the team_members table. So, 1. Create team 2. Add user to the team (team_members) table. How would I get the auto_incremented from the inserted create team query? Would $this->db->insert_id() work or does that only give the next insert_id of the table your about to query? Thanks. Getting the last query's insert_id - El Forum - 08-15-2007 [eluser]gunter[/eluser] http://ellislab.com/forums/viewthread/56038/ Getting the last query's insert_id - El Forum - 08-15-2007 [eluser]Kemik[/eluser] So that will get the last queries auto_inc value? Edit: Solved. |