title: Accessing last inserted row in mysql
body: <p>On my db-server i am inserting data in a table having a auto increment field say 'id'. Now i want to use the value of this last inserted 'id' in subsequent steps. I can use this:-</p>
  
  <pre><code>  select * from table_name order by id desc limit 1; 
  </code></pre>
  
  <p>But the problem here is, it is a server and many more insertions could be happening and there could be a case where i try to retrieve the data with the query i mentioned and get a different id ie. between my insert and select there could be some other insert and i wont get the value i inserted. Any way in which this could be addressed.?</p>
  
  <p>Thanks in advance.</p>