LeBlaireau
LeBlaireau

Reputation: 17467

wrapping mysql transaction

I have 3 mysql queries to run

mysql_query( "create temporary table here ");
mysql_query( "UPDATE Statement goes here ");
mysql_query( "DROP temporary table here  ") or die(mysql_error())

how do I wrap these in a transaction?

Upvotes: 0

Views: 215

Answers (2)

Kasia Gogolek
Kasia Gogolek

Reputation: 3414

you can use mysqli_multi_query

mysqli_multi_query("CREATE ...;UPDATE Statement.. ; DROP temp ");

note the ; between queries.

Upvotes: 0

Eugen Rieck
Eugen Rieck

Reputation: 65274

You don't. DDL statements, such as create temporary table here are never part of a transaction in MySQL.

Upvotes: 2

Related Questions