Welcome Guest, Not a member yet? Register   Sign In
Getting the last database identifier
#1

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

[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()
#3

[eluser]bikuta[/eluser]
cool thanks
so would I just call that once I've called the first add() method?




Theme © iAndrew 2016 - Forum software by © MyBB