게시물 삭제에 관한 질문입니다. > 그누3질답

그누3질답

게시물 삭제에 관한 질문입니다. 정보

그누보드 게시물 삭제에 관한 질문입니다.

본문

select * from where wr_id = '3'

1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where wr_id = '3'' at line 1

관리자 아이디로 접속해서 게시물 전체선택을 한 후, 삭제를 하려고 하니, 위와 같은 오류 메시지가 뜹니다.

게시물을 리스트에서 삭제하려고 하면 선택한 개수에 상관없이 위의 오류가 뜹니다.

게시물을 클릭하고 들어간 뷰 화면에서는 삭제가 잘 이루어 집니다.

디비 오류인것 같은데 봐도 모르겠습니다.

위의 에러는 http://www.ohman.or.kr/gnu3/?doc=bbs/gnuboard.php&bo_table=notice 이 게시판에서만 뜹니다.

게시판 스킨은 http://www.sir.co.kr/?doc=bbs/gnuboard.php&bo_table=skin3&sselect=ca_id&stext=1&page=4&wr_id=8245 를 사용하였습니다.

참고로 php 버젼은 4.3.10 , mysql 버젼은 4.0.18 입니다.

댓글 전체

정말 감사드립니다.
뒤에 숫자가 왜 붙어있는지 모르겠군요;;
미처 발견하지 못한 부분을 짚어주셔서 다시 한번 감사드립니다.
아주 잘 됩니다.^^
## 기본스킨에 있는것
<form name=frmgblist method='post' action='./?doc=bbs/gbdeleteall.php'>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<input type=hidden name=sselect  value='<?=$sselect?>'>
<input type=hidden name=stext    value='<?=$stext?>'>
<input type=hidden name=spart    value='<?=$spart?>'>
<input type=hidden name=page    value='<?=$page?>'>
<input type=hidden name=sw      value=''>

## Visual_Sun님께서 올려주신것
<form name=frmgblist method='post' action='./?doc=bbs/gbdeleteall.php'>
<input type=hidden name=bo_table2 value='<?=$bo_table?>'>
<input type=hidden name=sselect2  value='<?=$sselect?>'>
<input type=hidden name=stext2    value='<?=$stext?>'>
<input type=hidden name=section  value='<?=$section?>'>
<input type=hidden name=page    value='<?=$page?>'>
<input type=hidden name=sw      value=''>


bo_tabler, sselect, stext 뒤에 붙어있는 2가 어떤것인지 확인해보시고
작업하신것이 아니면 2를 제거후 다시해보세요.
루트님 답변 감사합니다.
저 한 게시판만 삭제가 되질 않는걸로 봐서, 스킨의 파일에 문제가 있는것 같은데요, 다른 스킨의 파일과 비교해봐도 도무지 다른곳을 찾을 수가 없습니다.
bbs/gbdeleteall.php는 전혀 손을 댄적이 없습니다.

혹시나 해서 스킨파일의 gblist.skin.php의 내용을 올립니다.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 8;
if ($is_category) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
?>

<style type=text/css>
    .bh  {font-family:돋움; font-size:11px; color: #C9759F}
    .tt {font-size:9pt;COLOR: #575757;}
</style>

<table width='<?=$width?>' align=center><tr><td>

<table width=100%>
<tr>
    <form name=fcategory method=get action='<?="./"?>'>
    <input type=hidden name=doc value='<?=$doc?>'>
    <td width=50%>
        <? if ($is_category) { ?>
            <select name=ca_id onchange="location='<?=$category_location?>'+this.value;">
            <option value=''>전체</option>
            <?=$category_option?>
            </select>
        <? } ?>
    </td>
    </form>
    <td width=50% align=right>게시물 <?=nf($total_count)?>건
    <?
    if ($is_admin == "default") {
        echo "<a href='$admin_href'><img src='$board_skin/icon_admin.gif' border=0 width=50 height=18 align=absmiddle></a>";
    }
    ?>
    </td>
</tr>
</table>
      <table width=100% border=0 cellpadding=0 cellspacing=0>
        <form name=frmgblist method='post' action='./?doc=bbs/gbdeleteall.php'>
          <input type=hidden name=bo_table2 value='<?=$bo_table?>'>
          <input type=hidden name=sselect2  value='<?=$sselect?>'>
          <input type=hidden name=stext2    value='<?=$stext?>'>
          <input type=hidden name=section  value='<?=$section?>'>
          <input type=hidden name=page    value='<?=$page?>'>
          <input type=hidden name=sw      value=''>
          <tr align=center style='background-color:#FFFFFF; text-align:center;'>
            <td width=11 height="19"><img src='<?="$board_skin/images/top_left.gif"?>' width="11" height="19" align="absmiddle"></td>
            <td width=50 height=19 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_num', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/no.gif"?>' border=0 alt='번호' align=absmiddle></span></td>
            <? if ($is_category) { ?>
            <td width=60 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('ca_id', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/category.gif"?>' border=0 alt='분류' align=absmiddle></span></td>
            <? } ?>
            <td width='' background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_subject', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/subject.gif"?>' border=0 alt='제목' align=absmiddle></span></td>
            <td width=100 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_name', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/name.gif"?>' border=0 alt='작성자' align=absmiddle></span></td>
            <td width=60 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_datetime', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/date.gif"?>' border=0 alt='등록일' align=absmiddle></span></td>
            <td width=40 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_hit', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/hit.gif"?>' border=0 alt='조회' align=absmiddle></span></td>
            <? if ($is_good) { ?>
            <td width=40 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_good', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/good.gif"?>' border=0 alt='추천' align=absmiddle></span></td>
            <? } ?>
            <? if ($is_nogood) { ?>
            <td width=40 background='<?="$board_skin/images/top_center_bg.gif"?>'>
              <?=subject_sort_link('wr_nogood', $qstr2)?>
              <span class=bh><img src='<?="$board_skin/images/bad.gif"?>' border=0 alt='비추천' align=absmiddle></span></td>
            <? } ?>
            <td width=12><img src='<?="$board_skin/images/top_right.gif"?>' width="12" height="19" align="absmiddle"></td>
          </tr>
          <tr>
            <td width=11 height="26"><img src='<?="$board_skin/images/se_left.gif"?>' width="11" height="26" align="absmiddle"></td>
            <td background='<?="$board_skin/images/se_center_bg.gif"?>' align="left"><img src='<?="$board_skin/images/se_left02.gif"?>'></td>
            <td colspan="4" background="<?="$board_skin/images/se_center_bg.gif"?>"></td>
<? if ($is_good) { ?>
            <td width=40 background="<?="$board_skin/images/se_center_bg.gif"?>"></td>
            <? } ?>
            <? if ($is_nogood) { ?>
            <td width=40 background="<?="$board_skin/images/se_center_bg.gif"?>"></td>
            <? } ?>
<td align="right" background="<?="$board_skin/images/se_center_bg.gif"?>"><img src='<?="$board_skin/images/se_right02.gif"?>'></td>
            <td width=12><img src='<?="$board_skin/images/se_right.gif"?>'></td>
          </tr>
          <?
// 번호에 이미지를 사용할 경우는 아래의 주석을 제거하고 $list[$i][num]의 내용을 수정후 사용하세요.
// if (!is_int($list[$i][num])) { $list[$i][num] = "<img src='$board_skin/img/arrow.gif'>"; }
?>
          <? for ($i=0; $i<count($list); $i++) { ?>
          <? if ($list[$i][num] == '공지') { $list[$i][num] = "<img src='$board_skin/icon_notice.gif' border=0 width=14 height=14>"; } // 공지를 이미지로 변환 ?>
          <? if ($list[$i][num] == '<font color=crimson><b>→</b></font>') { $list[$i][num] = "<img src='$board_skin/images/icon_arrow.gif' border=0 width=15 height=11>"; } // 화살표표시를 이미지로 변환 ?>
          <tr align=center>
            <td width=11 background='<?="$board_skin/images/left_bg.gif"?>'></td>
            <td width=50 height="25"><span class=tt>
              <?=$list[$i][num]?>
              </span></td>
            <? if ($is_category) { ?>
            <td width=60><span class=tt>
              <?=$list[$i][ca_name]?>
              </span></td>
            <? } ?>
            <td align=left>
              <? if ($is_checkdelete) { ?>
              <input type=checkbox name=chk_wr_id[] value='<?=$list[$i][wr_id]?>'>
              <? } ?>
              &nbsp;
              <?=$list[$i][reply]?>
              <?=$list[$i][icon_reply]?>
              <a href='<?=$list[$i][href]?>'>
              <? if ($list[$i][is_notice]) echo "<font color=#C84385><b>"; else echo "<span class=tt>"; ?>
              <?=$list[$i][subject]?>
              <? if ($list[$i][is_notice]) echo "</b></font>"; else echo "</span>"; ?>
              </a> <span style='font-size:8pt;'><span class=tt>
              <?=$list[$i][commentcnt]?>
              </span></span>
              <?=$list[$i][icon_new]?>
              <?=$list[$i][icon_file]?>
              <?=$list[$i][icon_link]?>
              <?=$list[$i][icon_hot]?>
              <?=$list[$i][icon_battle]?>
              <?=$list[$i][icon_secret]?>
            </td>
            <td width=100 nowrap><span class=tt>
              <?=$list[$i][name]?>
              </span></td>
            <td width=60><span class=tt>
              <?=$list[$i][datetime]?>
              </span></td>
            <td width=40><span class=tt>
              <?=$list[$i][wr_hit]?>
              </span></td>
            <? if ($is_good) { ?>
            <td width=40><span class=tt>
              <?=$list[$i][wr_good]?>
              </span></td>
            <? } ?>
            <? if ($is_nogood) { ?>
            <td width=40><span class=tt>
              <?=$list[$i][wr_nogood]?>
              </span></td>
            <? } ?>
            <td width=12 background='<?="$board_skin/images/right_bg.gif"?>'></td>
          </tr>
          <tr>
            <td width=11 background='<?="$board_skin/images/left_bg.gif"?>'></td>
            <td colspan=6 height=1 bgcolor=#E2E2E2></td>
<? if ($is_good) { ?>
            <td width=40 height=1 bgcolor=#E2E2E2></td>
            <? } ?>
            <? if ($is_nogood) { ?>
            <td width=40 height=1 bgcolor=#E2E2E2></td>
            <? } ?>
            <td width=12 background='<?="$board_skin/images/right_bg.gif"?>'></td>
          </tr>
          <? } ?>
          <? if (count($list) == 0) { echo "<tr>
  <td width=11 background='$board_skin/images/left_bg.gif'></td>
  <td colspan=6 align=center height=100 class='content contentbg'>자료가 없습니다.</td>";
  ?>
  <? if ($is_good) { ?>
            <td width=40></td>
            <? } ?>
            <? if ($is_nogood) { ?>
            <td width=40></td>
            <? } ?>
<?
echo "<td width=12 background='$board_skin/images/right_bg.gif'></td></tr>"; } ?>       
        <tr>     
            <td width=11><img src='<?="$board_skin/images/th_left.gif"?>'></td>
            <td background='<?="$board_skin/images/th_center_bg.gif"?>' align="left"><img src='<?="$board_skin/images/th_left02.gif"?>'></td>
            <td colspan="4" background="<?="$board_skin/images/th_center_bg.gif"?>"></td>
<? if ($is_good) { ?>
            <td width=40 background="<?="$board_skin/images/th_center_bg.gif"?>"></td>
            <? } ?>
            <? if ($is_nogood) { ?>
            <td width=40 background="<?="$board_skin/images/th_center_bg.gif"?>"></td>
            <? } ?>
<td align="right" background="<?="$board_skin/images/th_center_bg.gif"?>"><img src='<?="$board_skin/images/th_right02.gif"?>'></td>
            <td width=12><img src='<?="$board_skin/images/th_right.gif"?>'></td>
</tr>
        </form>
      </table>
<? if ($write_pages || $prev_section_href || $next_section_href) { ?>
<table width=100%>
<tr>
          <td align=center height=25>
            <? if ($prev_section_href) { echo "<a href='$prev_section_href'><img src='$board_skin/sectionprev.gif' border=0 alt='이전검색'></a>"; } ?>
            <span style='font-size:9pt; font-family:돋움;'>
            <?=$write_pages?>
            </span>
            <? if ($next_section_href) { echo "<a href='$next_section_href'><img src='$board_skin/sectionnext.gif' border=0 alt='다음검색'></a>"; } ?>
          </td>
</tr>
</table>
<? } ?>

<table width=100% border=0>
<tr>
          <td>
            <? if ($list_href) { echo "<a href='$list_href'><img src='$board_skin/list.gif' border=0 alt='목록' align=absmiddle></a>"; } ?>
            <? if ($write_href) { echo "<a href='$write_href'><img src='$board_skin/write.gif' border=0 alt='글쓰기' align=absmiddle></a>"; } ?>
            <? if ($is_checkdelete) { ?>
            <a href="javascript:all_checked(true);"><img src='<?="$board_skin/allchk.gif"?>' border=0 alt='전체선택' align=absmiddle></a>
            <a href="javascript:all_checked(false);"><img src='<?="$board_skin/allunchk.gif"?>' border=0 alt='선택해제' align=absmiddle></a>
            <a href="javascript:all_delete();"><img src='<?="$board_skin/delete.gif"?>' border=0 alt='선택삭제' align=absmiddle></a>
            <a href="javascript:all_move('copy');"><img src='<?="$board_skin/copy.gif"?>' border=0 alt='선택복사' align=absmiddle></a>
            <a href="javascript:all_move('move');"><img src='<?="$board_skin/move.gif"?>' border=0 alt='선택이동' align=absmiddle></a>
            <script language='javascript'>
            function all_checked(sw)
            {
                var f = document.frmgblist;

                for (var i=0; i<f.length; i++) {
                    if (f.elements[i].name == 'chk_wr_id[]') {
                        f.elements[i].checked = sw;
                    }
                }
            }

            function check_confirm(str)
            {
                var f = document.frmgblist;
                var chk_count = 0;

                for (var i=0; i<f.length; i++) {
                    if (f.elements[i].name == 'chk_wr_id[]' && f.elements[i].checked) {
                        chk_count++;
                    }
                }

                if (!chk_count) {
                    alert(str + "할 게시물을 하나 이상 선택하세요.");
                    return false;
                }
                return true;
            }

            // 선택한 게시물 삭제
            function all_delete()
            {
                var f = document.frmgblist;

                str = "삭제";
                if (!check_confirm(str)) {
                    return;
                }

                if (!confirm("선택한 게시물을 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다")) {
                    return;
                }

                f.action = "./?doc=bbs/gbdeleteall.php";
                f.submit();
            }

            // 선택한 게시물 복사 및 이동
            function all_move(sw)
            {
                var f = document.frmgblist;

                if (sw == 'copy') {
                    str = '복사';
                } else {
                    str = '이동';
                }

                                 
                if (!check_confirm(str)) {
                    return;
                }

                var sub_win = window.open('', 'gbmoveall', 'left=50, top=50, width=396, height=550, scrollbars=1');

                f.sw.value = sw;
                f.target = "gbmoveall";
                f.action = "./?doc=bbs/gbmoveall.php";
                f.submit();
            }
        </script>
            <? } ?>
          </td>
    <form name=fsearch method=get action='<?="./"?>'>
    <input type=hidden name=doc value='<?=$doc?>'>
    <input type=hidden name=bo_table value='<?=$bo_table?>'>
            <td align=right valign=bottom>
              <select name=sselect>
            <option value='concat(wr_subject,wr_content)'>제목+내용</option>
            <option value='wr_name'>이름</option>
            <option value='wr_num'>번호</option>
            <option value='wr_datetime'>날짜</option>
            <option value='wr_subject'>제목</option>
            <option value='wr_content'>내용</option>
            <option value='wr_hit'>읽음</option>
            <? if ($is_good) { ?><option value='wr_good'>추천</option><? } ?>
            <? if ($is_nogood) { ?><option value='wr_nogood'>비추천</option><? } ?>
        </select>
        <input type=text name=stext size=10 required itemname='검색어' value='<?=$stext?>'>
        <select name=soperator>
            <option value='0'>OR</option>
            <option value='1'>AND</option>
        </select>
        <input type=image src='<?="$board_skin/search.gif"?>' border=0 alt='검색' align=absmiddle>
    </td>
    </form>
</tr>
</table>

</td></tr></table>

<? if ($stext) { ?>
    <script language='JavaScript'>
        if ('<?=$sselect?>' == 'ca_id') {
            document.fcategory.ca_id.value = '<?=$stext?>';
            document.fsearch.stext.value = '';
        } else {
            document.fsearch.sselect.value  = '<?=$sselect?>';
            document.fsearch.soperator.value = '<?=(int)$soperator?>';
        }
    </script>
<? } ?>
from 과 where 사이에 삭제하고자 하는 게시판의 테이블 명이 포함되지 않았군요.
프로그램에 왜 $bo_table 값이 안넘어가는지를 체크해 보셔야 할것 같습니다.
전체 9,564
그누3질답 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT