그누보드 첨부파일에서 중간에 파일을 지웠을 때, 재정렬 하기
스샷은 없습니다만, 첨부파일 목록이 5개 있을때 3번째 삭제하고,
뷰페이지를 보면 목록에서 3번만 삭제되는데,
이것을 순차적으로 1, 2, 3, 4 로 재정렬 해줍니다.
[code]
function delete_null_file($target_board){
$null_del = "SELECT wr_id, bf_no, bf_content AS current_id FROM g5_board_file WHERE bo_table = '$target_board' AND length(bf_source)=0;";
$result = sql_query($null_del);
$row = sql_fetch_array($result);
//wr_id가져오기
$current_wr_id = $row['wr_id'];
//빈셀 삭제
sql_query("DELETE FROM g5_board_file WHERE length(bf_source) = 0 AND wr_id='$current_wr_id'");
//현재 bf_no 가져오기
$cnt_sql = "SELECT bf_no FROM g5_board_file WHERE bo_table = '$target_board' AND wr_id='$current_wr_id' AND length(bf_source)>0;";
$cnt_result = sql_query($cnt_sql);
//0부터 순차적으로 값 변경 업데이트
$i = 0;
while ($cnt_row = sql_fetch_array($cnt_result)) {
$temp_bf = $cnt_row['bf_no'];
sql_query("UPDATE g5_board_file SET bf_no='$i' WHERE wr_id='$current_wr_id' AND bf_no='$temp_bf';");
$i++;
}
}
[/code]
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5246 | node.js |
swallow
|
2년 전 | 1105 | |
| 5245 | PHP |
swallow
|
2년 전 | 2528 | |
| 5244 | PHP |
swallow
|
2년 전 | 1286 | |
| 5243 | JavaScript |
swallow
|
2년 전 | 685 | |
| 5242 | node.js |
swallow
|
2년 전 | 666 | |
| 5241 | node.js |
swallow
|
2년 전 | 779 | |
| 5240 | MySQL |
swallow
|
2년 전 | 808 | |
| 5239 | MySQL | 2년 전 | 784 | ||
| 5238 | JavaScript | 2년 전 | 983 | ||
| 5237 | 웹서버 |
swallow
|
2년 전 | 3989 | |
| 5236 | PHP |
swallow
|
2년 전 | 900 | |
| 5235 | PHP |
swallow
|
2년 전 | 1378 | |
| 5234 | 기타 | 2년 전 | 761 | ||
| 5233 | jQuery |
swallow
|
2년 전 | 2036 | |
| 5232 | 2년 전 | 618 | |||
| 5231 | 2년 전 | 1173 | |||
| 5230 | 2년 전 | 1076 | |||
| 5229 | PHP |
swallow
|
2년 전 | 1023 | |
| 5228 | MySQL | 2년 전 | 726 | ||
| 5227 | PHP |
swallow
|
2년 전 | 837 | |
| 5226 | PHP |
swallow
|
2년 전 | 1811 | |
| 5225 | PHP | 2년 전 | 576 | ||
| 5224 | node.js |
swallow
|
2년 전 | 4083 | |
| 5223 | PHP |
swallow
|
2년 전 | 1317 | |
| 5222 | 기타 |
techstar
|
2년 전 | 563 | |
| 5221 | PHP | 2년 전 | 653 | ||
| 5220 |
swallow
|
2년 전 | 905 | ||
| 5219 | 2년 전 | 881 | |||
| 5218 | 2년 전 | 523 | |||
| 5217 | 2년 전 | 1001 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기