Welcome Guest, Not a member yet? Register   Sign In
Getting the last query's insert_id
#1

[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.
#2

[eluser]gunter[/eluser]
http://ellislab.com/forums/viewthread/56038/
#3

[eluser]Kemik[/eluser]
So that will get the last queries auto_inc value?

Edit: Solved.




Theme © iAndrew 2016 - Forum software by © MyBB