I am inserting a record and I want to use the identifier of the last inserted record. This is what I tried:
$sql =
'INSERT INTO customer
(first_name,
last_name,
email,
password,
date_created,
dob,
gender,
customer_type)
VALUES(:first_name,
:last_name,
:email,
:password,
:date_created,
:dob,
:gender,
:customer_type)' . ' SELECT LAST_INSERT_ID()' ;
I get an error:
You have an error in the SQL syntax; check the manual that matches your MySQL server version for the correct syntax to use next to "SELECT LAST_INSERT_ID ()". Can someone show me where my mistake is? Thanks!
source
share