응용개발

PHP 프로그램을 작성할때 주의할 점

by Prototype posted Jul 01, 2009
큐브리드의 PHP모듈은 명시적으로 commit 을 하지 않으면 자동으로 rollback 을 수행합니다.

즉, update, insert 등의 쿼리나, create , alter 등의 쿼리문을 사용할 시, commit 을 하지 않으면 화면에는 정상 수행 된 것 같이 표시되나, 실제로 DB에 적용이 되지 않습니다.

......
$cubrid_con = cubrid_connect($host_ip, $host_port, $db_name,$user_id,$user_pw);
if (!$cubrid_con) { echo "DB 접속 오류"; exit;  }

$qry = "insert into .....";

$result = cubrid_execute($cubrid_con, $sql);
.....

if($result) {
cubrid_commit($cubrid_con); //명시적으로 commit 한다.
}



명시적으로 commit 를 해야만 DB에 변경된 내용을 적용 할 수 있습니다.

Articles

1 2 3