title: PHP & MySQL - Generate invoice number from an integer from the database
body: <p>I need to generate an invoice number from an integer of a table with an auto incrementing ID of the database where the user purchases saved.</p>
  
  <p><strong>Example of the table invoice database:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/2KeMt.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/2KeMt.jpg" alt="enter image description here"></a></p>
  
  <p>The invoice number format floor do one of two ways.</p>
  
  <p><strong>Example 1: of the number of invoices without prefix:</strong></p>
  
  <p>0000001 |
  0000002 |
  0000003 |
  0000004 |
  0000005</p>
  
  <p><strong>Example 2: the number of invoices with prefixes:</strong></p>
  
  <p>F-0000001 |
  F-0000002 |
  F-0000003 |
  F-0000004 |
  F-0000005</p>
  
  <p><strong>Question:</strong> </p>
  
  <p><strong>1) ¿What is the best way to do this, you can do directly from MySQL or PHP?</strong></p>
  
  <p><strong>2) ¿What is the most appropriate format Example 1 or Example 2?</strong></p>
  
  <p><em>I appreciate your support as always!</em></p>