简体   繁体   中英

CodeIgniter: getting the id of a newly created record

I'm using the CXTags CI tagging library. The tag_ref table takes a row_id. So my posts can have multiple tags added to them. The method for adding tags takes the table and row_id of the entity being tagged. In my case the table is 'posts' and row_id would be the id of the posts record.

I want to do something like this:

$this->db->insert('posts', $_POST);
$this->CXTags->add_tags($data); //where data holds table name and row_id

Any help most appreciated!

Billy

$this->db->insert_id()

您知道用户指南是您的朋友。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM