title: How to get last inserted row ID from WordPress database?
body: <p>My WordPress plugin has a table with a <strong>AUTO_INCREMENT</strong> 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. </p>
  
  <p>The feature is to using AJAX to post data to server to insert into DB. The new row ID is returned in the AJAX response to update client status. It is possible that multiple clients are posting data to server at the same time. So, I have to make sure that each AJAX request get the EXACT new row ID in response.</p>
  
  <p>In PHP, there is a method called <strong><em>mysql_insert_id</em></strong> for this feature.But, it is valid for race condition only if the argument is <strong><em>link_identifier</em></strong> of last operation. My operation with database is on $wpdb. How to extract the <strong><em>link_identifier</em></strong> from $wpdb to make sure mysql_insert_id work? Is there any other way to get the last-inserted-row id from $wpdb?</p>
  
  <p>Thanks.</p>