views:

37

answers:

1

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?

+5  A: 

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

$id = $store_id['id'];
cletus