0
我正在用mySQL第一次嘗試事務。mysqli_multi_query和mysql事務
我想知道爲此目的使用mysqli_multi_query是否安全。也就是說,我可以假設,如果任何SQL語句失敗,一切都會回滾?
$query = "
START TRANSACTION;
(a bunch of SQL statements)
COMMIT;
";
if (mysqli_multi_query($connection, $query)) {
do {
if ($result = mysqli_store_result($connection)) mysqli_free_result($result);
} while (mysqli_next_result($connection));
}
感謝,