我正在开发我的第一个php / mysql应用程序,并想检查是否已使用mysqli正确实现了事务。我目前的代码:
$con_post = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
$sql_query = 'Variable list of sql statements';
if ($con_post)
{
mysqli_begin_transaction($con_post);
mysqli_multi_query($con_post, $sql_query);
if (mysqli_error($con_post))
{
mysqli_rollback($con_post);
}
else
{
mysqli_commit($con_post);
deliverResponse(200, "Success", true);
}
mysqli_close($con_post);
}
else
{
deliverResponse(503, "Error: Cannot connect to database", NULL);
}
我想要实现的是:
谢谢