$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()' ;
Can anyone tell me if the syntax is right? I am having problems using mysql_insert_id that is why i am using SELECT LAST_INSERT_ID()
the error message:
mysql_insert_id() [function.mysql-insert-id]: Access denied for user ‘ODBC’@’localhost’
It will work if you add the closing
;between the two queries (at least MySQL will accept it, I don’t know if PHP will complain). But, as above, it’s not very good code and, if you separate it, will be a race condition. Figure out your kinks withmysql_insert_id()and use that like it’s designed for.