How to get auto increment id by PDO before execute
<p>I looking for an solutions on 'How to get auto increment id by PDO before execute', is there a way to get the future ID in pdo. </p>

<p>I tried lastinsertID but that can only after the 'execute'. </p>

<p>Below you find the original:</p>

<pre><code>$last_id = $dbh-&gt;lastInsertId(); //last insert ID
</code></pre>

<p>My PDO Query</p>

<pre><code>$insert = $dbh-&gt;prepare('INSERT INTO _gegevensgebruiker (id, company, name, adress, zipcode, city, tel, email, employees, representative, email_re, function, date_end, user, `date_add`) VALUES (NULL, :company, :name, :adress, :zipcode, :city, :tel, :email, :employees, :representative, :email_re, :function, :date_end, :meid, NOW())');
</code></pre>

<p>I know the way to get the last_id but i need a solution to get an future id inside the PDO statement. </p>

<p>Below my instert_ID solution outside the PDO statement:</p>

<pre><code>$lastusers_sql = $dbh-&gt;prepare('SELECT MAX(id) FROM users');
$lastusers_sql-&gt;execute();
$last_id = $lastusers_sql-&gt;fetchColumn();
</code></pre>