학

전체선택 선택삭제하면 전체 게시물 수가 마이너스(-)로 내려갈때

그냥 삭제하면 괜찮은데, 게시물 목록 보기에서 전체 선택 삭제를 하면 전체 게시물 수가 마이너스(-) 이하로 내려가 버리는 문제가 생겨서 gbdeleteall.php에서 마지막쯤의 header(...) 함수 윗 부분을 고쳐서 해결 했습니다.

---------------------------------고치기 전----------------------------------------
// 파일삭제
@unlink($gnu_path . "data/file/$bo_table/write[wr_file1]");
@unlink($gnu_path . "data/file/$bo_table/write[wr_file2]");

// 게시글 1 감소
sql_query_error("update $cfg[table_board] set bo_total_count = bo_total_count - 1 where bo_table = '$bo_table'");
}

header("location:gnuboard.php?$qstr&page=$page");

---------------------------------고친 후----------------------------------------
// 파일삭제
@unlink($gnu_path . "data/file/$bo_table/write[wr_file1]");
@unlink($gnu_path . "data/file/$bo_table/write[wr_file2]");

// 게시글 1 감소
if(mysql_affected_rows($connect) > 0) {
sql_query_error("update $cfg[table_board] set bo_total_count = bo_total_count - 1 where bo_table = '$bo_table'");
}
}

header("location:gnuboard.php?$qstr&page=$page");

----------------------------- 해설 ---------------------------------
'mysql 연결에서 delete 쿼리로 인해 영향을 받았을 때만 총 게시물 수를 조정하여라~' 입니다.
|

댓글 1개

전 이렇게 했죠...
update $cfg[table_board] set bo_total_count = bo_total_count - 1 where bo_table = '$bo_table' and bo_total_count >0
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
03-07-18 조회 2,002
03-07-18 조회 2,070
03-07-18 조회 2,448
MMANDO
03-07-18 조회 3,369
03-07-17 조회 2,579
03-07-16 조회 2,101
03-07-15 조회 2,676
03-07-12 조회 2,332
03-07-12 조회 1,979
03-07-12 조회 2,201
03-07-12 조회 1,939
03-07-12 조회 3,444
03-07-12 조회 2,259
03-07-12 조회 4,090
03-07-10 조회 2,149
03-07-10 조회 1,948
03-07-09 조회 2,145
03-07-09 조회 2,143
03-07-09 조회 2,060
03-07-08 조회 1,945