학

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

· 2003-07-16 (수) 10:32:15 · 2083 · 1
그냥 삭제하면 괜찮은데, 게시물 목록 보기에서 전체 선택 삭제를 하면 전체 게시물 수가 마이너스(-) 이하로 내려가 버리는 문제가 생겨서 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개

2003-08-13 (수) 21:49:12
전 이렇게 했죠...
update $cfg[table_board] set bo_total_count = bo_total_count - 1 where bo_table = '$bo_table' and bo_total_count >0
댓글을 작성하시려면 로그인이 필요합니다.

그누3 팁자료실

1,026건
+
제목 글쓴이 날짜 조회
03-07-18 조회 1,988
03-07-18 조회 2,056
03-07-18 조회 2,431
MMANDO
03-07-18 조회 3,353
03-07-17 조회 2,566
03-07-16 조회 2,084
03-07-15 조회 2,662
03-07-12 조회 2,316
03-07-12 조회 1,959
03-07-12 조회 2,179
03-07-12 조회 1,922
03-07-12 조회 3,427
03-07-12 조회 2,236
03-07-12 조회 4,074
03-07-10 조회 2,128
03-07-10 조회 1,932
03-07-09 조회 2,128
03-07-09 조회 2,121
03-07-09 조회 2,039
03-07-08 조회 1,925