Support » Plugins » How to get primary key of last inserted row into database?

  • Resolved mocheng

    (@mocheng)


    My plugin has a table with a AUTO_INCREMENT primary key field called ID. When a new row is inserted into the table, I’d like to get the ID value of the insertion.

    In PHP, there is a method called mysql_insert_id for this feature.But, it is valid for race condition only if the argument is link_identifier of last operation. My operation with database is on $wpdb. How to extract the link_identifier from $wpdb to make sure mysql_insert_id work? Is there any other way to get the last-inserted-row id from $wpdb?

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to get primary key of last inserted row into database?’ is closed to new replies.