开发者

php basic array question

开发者 https://www.devze.com 2022-12-19 04:14 出处:网络
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:

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?


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

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

精彩评论

暂无评论...
验证码 换一张
取 消