GnegDevelop
Programmer
I am using a Cold Fusion front end and I can't figure out how to use the LAST_INSERT_ID() method in my CF application. When I place the method within a <cfquery> I always get an invalid syntax error.
<cfquery datasource="#request.main_dsn#" name="insertMem">
<!--- Insert member --->
INSERT INTO member(firstName,
lastName,
email,
member_type_fk)
VALUES( '#form.firstname#',
'#form.lastname#',
'#form.email#',
1);
<!--- Update Username --->
UPDATE User
SET member_fk = LAST_INSERT_ID()
WHERE '#form.login#' = user_login;
</cfquery>
The error is:
Syntax error or access violation: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; UPDATE User SET member_fk = LAST_INSERT_ID()
It seems that Cold Fusion can't use this method. What do I do? Thanks
<cfquery datasource="#request.main_dsn#" name="insertMem">
<!--- Insert member --->
INSERT INTO member(firstName,
lastName,
email,
member_type_fk)
VALUES( '#form.firstname#',
'#form.lastname#',
'#form.email#',
1);
<!--- Update Username --->
UPDATE User
SET member_fk = LAST_INSERT_ID()
WHERE '#form.login#' = user_login;
</cfquery>
The error is:
Syntax error or access violation: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; UPDATE User SET member_fk = LAST_INSERT_ID()
It seems that Cold Fusion can't use this method. What do I do? Thanks