Welcome Guest, Not a member yet? Register   Sign In
MySQL Insert ID?
#1

[eluser]Tim Stackhouse[/eluser]
I'm such a newb... Anyway, I've poured over the User Guide and the Wiki and I can't figure out how to get the last inserted id. Here's the scenario:

I have 2 classes and corresponding tables: User and Person. User has a foreign key constraint that references person, which may or may not already have a record for a person trying to register. I've got this part taken care of. However When it comes time to save their info, I'll need to know the id of the person object I created if one didn't already exist, so what do I call to get that?
#2

[eluser]NogDog[/eluser]
$this->db->insert_id()
#3

[eluser]Tim Stackhouse[/eluser]
Thanks. I was looking in the wrong spot. I feel like an idiot now Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB