title: PHP/MySQL generating incremental invoice numbers
body: <p>I have to generate in PHP invoices with incremental numbers starting from 1.
  My idea is to create a table with an autoincrement field starting from 1.
  When a user makes a payment, I look at the table for the last entry saved, I get its field value (the autoincrement one) and I make +1 to generate the invoice number and I save a new entry with the new invoice number to keep track of it.  Is my idea correct or not? What about if 2 users looked at the table at the same time (2 queries)? In this case they will both get from it the same last saved value and will end up with the same invoice numbers generated. Is this something that can happen?                                                                           Tahnks.</p>