전체선택 선택삭제하면 전체 게시물 수가 마이너스(-)로 내려갈때 정보
그누호환 전체선택 선택삭제하면 전체 게시물 수가 마이너스(-)로 내려갈때본문
그냥 삭제하면 괜찮은데, 게시물 목록 보기에서 전체 선택 삭제를 하면 전체 게시물 수가 마이너스(-) 이하로 내려가 버리는 문제가 생겨서 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 쿼리로 인해 영향을 받았을 때만 총 게시물 수를 조정하여라~' 입니다.
---------------------------------고치기 전----------------------------------------
// 파일삭제
@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
1
댓글 전체
전 이렇게 했죠...
update $cfg[table_board] set bo_total_count = bo_total_count - 1 where bo_table = '$bo_table' and bo_total_count >0
update $cfg[table_board] set bo_total_count = bo_total_count - 1 where bo_table = '$bo_table' and bo_total_count >0