/* Start transaction */
mysqli_begin_transaction($db_connect);
try{
$query = "INSERT INTO `board` SET ";
$query.= "`title` = '$title', ";
$query.= "`contents` = '$new_contents', ";
$query.= "`state` = '$state', ";
$query.= "`writer_id` = '$writer_id', ";
//$query.= "`attach_files` = '$attach_files', ";
$query.= "`in_date` = NOW() ";
$result = get_query($db_connect, $query);
if($result == true){
$status = "success";
}
/*커밋*/
mysqli_commit($db_connect);
} catch (mysqli_sql_exception $exception) {
/*롤백*/
mysqli_rollback($db_connect);
throw $exception;
}
[MySql][PHP] 트랜잭션, transaction
0 Comments