我正在尝试插入一个带有一些字段的表格
$ecode = 1000;
$location = 'B';
$file_id = 1;
$accessed_on = '30-NOV-14';
我的代码是
$conn = oci_connect('username', 'passwd', '//server/db');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else {
}
$query_Test = "
insert into example(ECODE,LOCATION,FILE_ID,ACCESSED_ON)
values($ecode,'$location',$file_id,'$accessed_on')";
$parse_Test = oci_parse($conn, $query_Test);
if(oci_execute($parse_Test)) {
echo 'Success';
$query_Test1 = "
update example
set ACCESSED_ON=03-nov-14,
where LOCATION='B'";
$parse_Test1 = oci_parse($conn, $query_Test1);
if(oci_execute($parse_Test1)){
oci_rollback($conn);
}
}
但是当query_Test1失败时,它不会回滚query_Test。该怎么办?请有人帮忙,谢谢!