Re: The right syntax for last insert - MySQL
>MySQL doesn't allow multiple statements in a single query unless you >change a server config option. It's a form of SQL injection >protection. So just run the two statements in two CFQUERY tags. >You'll need to ensure they're on the same connection with no >interleaved queries though, so make sure you use CFTRANSACTION if, for >some reason, you're not already. Thanks barney! That got me headed down the right path. Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317953 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: The right syntax for last insert - MySQL
Found a beautiful post by ben on this subject. Thanks ben! http://www.bennadel.com/blog/1209-Turning-On-Multiple-Statements-In-ColdFusion-8-MySQL-4-5-Datasource.htm Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317952 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: The right syntax for last insert - MySQL
MySQL doesn't allow multiple statements in a single query unless you change a server config option. It's a form of SQL injection protection. So just run the two statements in two CFQUERY tags. You'll need to ensure they're on the same connection with no interleaved queries though, so make sure you use CFTRANSACTION if, for some reason, you're not already. cheers, barneyb On Wed, Jan 14, 2009 at 10:48 AM, Will Tomlinson wrote: > I don't want to use the new result variable in CF8 here. What's the right > syntax for getting the last inserted ID in mySQL. I'm getting a syntax error > with this: > > insert into sometable (fields...) > values (values) > ; > select last_insert_id() as lastinsert > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317950 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
The right syntax for last insert - MySQL
I don't want to use the new result variable in CF8 here. What's the right syntax for getting the last inserted ID in mySQL. I'm getting a syntax error with this: insert into sometable (fields...) values (values) ; select last_insert_id() as lastinsert ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317949 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4