How to get the last inserted ID

QuestionsHow to get the last inserted ID
Roy asked 11 years ago

I see that this will get the last inserted ID:

$e["on_after_insert"] = array("after_insert", null, true); // return last inserted id for further working

but I don't see and docs on how to reference this ID in my function

e.g.

function after_insert($data)
{
$LastInsertedID = (what?)
}

Can you explain how to get the last inserted ID?

thanks

Roy.

2 Answers
Abu Ghufran answered 11 years ago

You can print_r($data) and check output in firebug insert call response.

It's usually $data["<first-column-name>"]

Roy answered 11 years ago

Thanks.

That pointed me in the right direction.

Roy.

Your Answer

18 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?