0

I'm having trouble getting the value of the last insert Id from doctrine. I did a bit of research and I found that the following should work:

//save the store now
$store = new Store();
$store->url = $this->form_validation->set_value('website');
$store->save();
$store_id = $store->identifier();

echo print_r($store->identifier());

Returns

Array ( [id] => 1000034 )

How do I pull just the value (1000034) out of the array and set it in a variable that I can use elsewhere?

1 Answer 1

5

Your $store_id is an associative array with a single value keyed by "id" so:

$id = $store_id['id'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.