그누보드 관리자페이지 삭제(delete)구현 도와주세요
본문
<form name="fitemlistupdate" method="post" action="./hello_mlistupdate.php" onsubmit="return fitemlist_submit(this);" autocomplete="off">
<tr>
<th scope="col" rowspan="2"> // 전체체크박스
<label for="chkall" class="sound_only">상품 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<td class="td_chk"> //체크박스
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['cp_idx']); ?></label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
</td>
<td class="td_mng"> //수정
<a href="./hello_mform.php?w=u&cp_idxs=<?php echo $row['cp_idxs']; ?>&cp_idx=<?php echo $row['cp_idx']; ?>&<?php echo $qstr; ?>"><span class="sound_only"><?php echo htmlspecialchars2(cut_str($row['cp_idx'],250, "")); ?> </span>수정</a>
</td>
</tr>
//테이블 밖의 삭제버튼
<div class="btn_list01 btn_list">
<?php if ($is_admin == 'super') { ?>
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
<?php } ?>
</div>
//삭제 자바스크립트
function fitemlist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("정말 삭제 하시겠습니까?")) {
return false;
}
}
return true;
}
//sql문
if ($w == "u" || $w == "d")
check_demo();
if ($w == '' || $w == 'u')
auth_check($auth[$sub_menu], "w");
else if ($w == 'd')
auth_check($auth[$sub_menu], "d");
@mkdir(G5_DATA_PATH."/item", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/item", G5_DIR_PERMISSION);
$cp_ygubun=$_POST['cp_ygubun'];
$cp_ygubuns=implode("','",$cp_ygubun);
$cp_ygubun=implode(",",$cp_ygubun);
// input vars 체크
if($w == ''){
$sql="insert into hello_mobile set ";
$sql.="cp_idxs='".$cp_idxs."' ";
$sql.=" , category='".$category."' ";
$sql.=" , phone_plan='".$phone_plan."' ";
$sql.=" , basic='".$basic."' ";
$sql.=" , new_RB='".$new_RB."' ";
$sql.=" , phone_n_RB='".$phone_n_RB."' ";
$sql.=" , voice='".$voice."' ";
$sql.=" , sms='".$sms."' ";
$sql.=" , data='".$data."' ";
sql_query($sql);
if($cp_idx){}else{
$sql="SELECT * FROM hello_mobile order by cp_idx desc limit 1";
$result = sql_query($sql);
while($row=sql_fetch_array($result)){
$cp_idx= $row['cp_idx'];
}
}
}else if($w == 'u'){
$sql="update hello_mobile set ";
$sql.=" category='".$category."' ";
$sql.=" , phone_plan='".$phone_plan."' ";
$sql.=" , basic='".$basic."' ";
$sql.=" , new_RB='".$new_RB."' ";
$sql.=" , phone_n_RB='".$phone_n_RB."' ";
$sql.=" , voice='".$voice."' ";
$sql.=" , sms='".$sms."' ";
$sql.=" , data='".$data."' ";
$sql.=" where cp_idx=".$cp_idx;
sql_query($sql);
if($cp_idx){
}else{
$sql="SELECT * FROM hello_mobile order by cp_idx desc limit 1";
$result = sql_query($sql);
while($row=sql_fetch_array($result)){
$cp_idx= $row['cp_idx'];
}
}
}else if($w == 'd'){
$sql="delete from hello_mobile";
$sql.=" where cp_idx=".$cp_idx;
sql_query($sql);
if($cp_idx){
}else{
$sql="SELECT * FROM hello_mobile order by cp_idx desc limit 1";
$result = sql_query($sql);
while($row=sql_fetch_array($result)){
$cp_idx= $row['cp_idx'];
}
}
}
삭제하시겠습니까 ?라는 alert 도 잘 나오고 오류도 없고
맨밑에 location 으로 list 쪽으로 뺴놔서 리스트로는 가지는데 delte 가 안됩니다.
수정은 잘 됩니다.
cp_dixs 값을 넘겨야하는것 같은데 아무리 찾아봐도 체크하는 방법도 모르겠고
왜 delete문이 실행이 안되는지 잘 모르겠습니다 도와주시면 감사하겠습니다
!-->답변 1
}else if($w == 'd'){
$sql="delete from hello_mobile";
$sql.=" where cp_idx=".$cp_idx;
sql_query($sql, true);
여게서 query문 에러 메시지를 확인해 보세요.
답변을 작성하시기 전에 로그인 해주세요.