Getting the last database identifier |
[eluser]bikuta[/eluser]
Hi, I was wondering whether it was possible with active query to get the last id that was generated after a new record has been entered into the database. So basically I've got something like this: $this->obj_model->add($data); // need to get unique id from previous command to update a value in $otherdata $this->otherobj_model->add($otherdata); the add() methods just calls a $this->db->insert command.
[eluser]LuckyFella73[/eluser]
Have a look at the user guide: http://ellislab.com/codeigniter/user-gui...lpers.html should be: Code: $this->db->insert_id()
[eluser]bikuta[/eluser]
cool thanks so would I just call that once I've called the first add() method? |
Welcome Guest, Not a member yet? Register Sign In |