특정게시판 댓글 삭제

게시물 검색을 해서 아래의 방법을 알아서 실행하니까 오류가 나네요

<?
// 코멘트 삭제
include_once("./_common.php");

$write_table = 삭제하기 원하는 테이블명;

$res = sql_query(" select * from $write_table where wr_comment > 0 order by wr_id desc ");

while($row=sql_fetch($res)){

$gd_qry = " delete from $write_table where wr_parent = '$row[wr_id]' and wr_is_comment > 0 ";

mysql_query($gd_qry);
}

?>


(테이블명 : back ) 이라고 입력했는데 아래와 같이 오류가 뜨는데 해결방법좀 알려주세요.
--------------------------

select * from back where wr_comment > 0 order by wr_id desc

1146 : Table 'naomi.back' doesn't exist

error file : /board/del.php

------------------------------
|

댓글 3개

<?
// 코멘트 삭제
include_once("./_common.php");

$write_table = g4_write_back ;

$res = sql_query(" select * from $write_table where wr_comment > 0 order by wr_id desc ");

while($row=sql_fetch($res)){

$gd_qry = " delete from $write_table where wr_parent = '$row[wr_id]' and wr_is_comment > 0 ";

mysql_query($gd_qry);
}

?>

위에 처럼 수정했는데 아래와 같이 오류가 뜨네요 ㅠ.ㅠ

--------------------------------------------------------------------------
Resource id #13

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 'Resource id #13' at line 1

error file : /board/del.php
while($row=sql_fetch($res)){

===>

while($row=sql_fetch_array($res)){
<?
// 코멘트 삭제
include_once("./_common.php");

$write_table = g4_write_back ;

$res = sql_query(" select * from $write_table where wr_comment > 0 order by wr_id desc ");

while($row=sql_fetch_array($res)){

$gd_qry = " delete from $write_table where wr_parent = '$row[wr_id]' and wr_is_comment > 0 ";

mysql_query($gd_qry);
}

?>

이렇게 바꾸 었는데 이번에는 아무런 반응도 없네요.. ㅠ.ㅠ

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고