add ($data);" method to obtain the primary key id of the newly added data."/> add ($data);" method to obtain the primary key id of the newly added data.">
Home >PHP Framework >ThinkPHP >How to get the modified id in thinkphp3.2
thinkphp3.2 Method to obtain the modified id: 1. Open the corresponding tp file; 2. Instantiate the User object through "$User = D("User");"; 3. Through "$insert = $User->add($data);" to get the primary key id of the new data.
#The operating environment of this tutorial: Windows 7 system, thinkphp version 3.2, Dell G3 computer.
How to get the modified id in thinkphp3.2?
thinkphp3.2.3 Get the primary key id of newly added data
tp3 itself inserts data and returns its primary key id value
eg:
$User = D("User"); // 实例化User对象 $data['username'] = $userinfo['nickname']; $data['tel'] = $userinfo['province']; $data['portrait'] = $userinfo['figureurl_qq_2']; $data['time'] = time(); $insert = $User->add($data);
Print $insert is the primary key value
Recommended learning: "thinkPHP Video Tutorial"
The above is the detailed content of How to get the modified id in thinkphp3.2. For more information, please follow other related articles on the PHP Chinese website!