Why does this query work in straight MySQL but not in CF?

I'm trying to duplicate a row in a MySQL table and give it a new ID (which is the primary key column.) If I run the query directly through phpMyAdmin, it works. If I run it on my CF page, it gives me the following error:

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 tempEvent SET ID = NULL; INSERT INTO calendar SELECT * FROM tempEvent' at line 4

Do you know why this would be? (As a side note, I get the same error if I use the cfqueryparam tag or hardcode a value, and with/without semicolons.) Thanks!

<cfquery datasource="#APPLICATION.ds#" result="copiedEvent">
		SELECT * FROM calendar 
		WHERE ID = <cfqueryparam value="#FORM.eventID#" cfsqltype="CF_SQL_INTEGER">;
	UPDATE tempEvent 
	INSERT INTO calendar SELECT * FROM tempEvent;

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russ SuterSenior Software DeveloperCommented:
You're actually running 4 separate statements here and most data providers won't accept multiple statements in a single call. You'll need to separate your statements and call them one at a time.

Another way of putting it is that the data provider doesn't like semicolons. Rather than sending everything as a single block of text you'll need to send each statement separately and make sure there are no semicolons in your SQL statement.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SiobhanElaraAuthor Commented:
PERFECT, thank you so much! All working now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.