时间:2021-07-01 10:21:17 帮助过:4人阅读
public static function exec_sql_tran($arr_sql){
$result=true;
$con = new MySQLi(DBHOST,DB_USER,DB_PASSWD,DB_NAME);
$con->autocommit(FALSE);
foreach($arr_sql as $key=>$sql){
if (!$con->query($sql)) {
echo $con->error."
/";
$resulf=false;
$con->rollback();
break;
}
}
print_r($result);
if($result){
$con->commit();
}
else{
$con->rollback();
}
$con->close();
}