Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LAST_INSERT_ID() Method Question

Status
Not open for further replies.

GnegDevelop

Programmer
Jul 2, 2003
4
US
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=&quot;#request.main_dsn#&quot; name=&quot;insertMem&quot;>
<!--- 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
 
The problem seems to be that ColdFusion doesn't support multiple MySQL queries in one [tt]<cfquery>[/tt] block.

//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top