Created
August 25, 2011 09:39
-
-
Save hamaco/1170326 to your computer and use it in GitHub Desktop.
MySQLのトランザクションが…… => @suin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$con1 = mysql_connect("127.0.0.1", "root", null, true); mysql_select_db("test_db", $con1); | |
$con2 = mysql_connect("127.0.0.1", "root", null, true); mysql_select_db("test_db", $con2); | |
mysql_query("CREATE TABLE test (id int)engine=InnoDB", $con1); | |
mysql_query("BEGIN", $con1); | |
mysql_query("INSERT INTO test VALUES(1)", $con1); | |
mysql_query("INSERT INTO test VALUES(2)", $con2); | |
mysql_query("ROLLBACK", $con1); | |
$result = mysql_query("SELECT * FROM test", $con1); | |
while ($row = mysql_fetch_assoc($result)) { | |
var_dump($row); | |
} | |
mysql_query("DROP TABLE test", $con1); | |
mysql_close($con1); | |
mysql_close($con2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment