title: PDO get the last ID inserted
body: <p>I have a query, and I want to get the last ID inserted. The field ID is the primary key and auto incrementing.</p>
  
  <p>I know that I have to use this statement:</p>
  
  <pre><code>LAST_INSERT_ID()
  </code></pre>
  
  <p>That statement works with a query like this:</p>
  
  <pre><code>$query = "INSERT INTO `cell-place` (ID) VALUES (LAST_INSERT_ID())";
  </code></pre>
  
  <p>But if I want to get the ID using this statement:</p>
  
  <pre><code>$ID = LAST_INSERT_ID();
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Fatal error: Call to undefined function LAST_INSERT_ID()
  </code></pre>
  
  <p>What am I doing wrong?</p>