-
Notifications
You must be signed in to change notification settings - Fork 0
/
item_delete.php
28 lines (23 loc) · 957 Bytes
/
item_delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
include "config.php"; //데이터베이스 연결 설정파일
include "util.php"; //유틸 함수
$conn = dbconnect($host,$dbid,$dbpass,$dbname);
mysqli_autocommit($conn,FALSE); //Disable auto-commit
mysqli_query($conn, "set session transaction isolation level serializable"); // set session consistency level to serializable
mysqli_begin_transaction($conn, MYSQLI_TRANS_START_READ_WRITE); // set transaction as read & write because it deletes from table
$item_name = $_GET['item_name'];
$sql = ("DELETE FROM item WHERE item_name='".$item_name."'");
$ret = mysqli_query($conn, $sql);
if(!$ret)
{
mysqli_rollback($conn); // If failure happens, rollback
msg('Query Error : '.mysqli_error($conn));
}
else
{
mysqli_commit($conn); // If no error happens, leave commit
s_msg ('성공적으로 삭제 되었습니다');
echo "<meta http-equiv='refresh' content='0;url=item_list.php'>";
}
mysqli_close($conn); // Close connection
?>