코멘트 wr_1 값을 넣어 2개로 코멘트 출력 sql db 불러오는방법

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
코멘트 wr_1 값을 넣어 2개로 코멘트 출력 sql db 불러오는방법

QA

코멘트 wr_1 값을 넣어 2개로 코멘트 출력 sql db 불러오는방법

본문

코멘트를 2종류로 나뉘어

 

한 게시글에서 공구를 할까합니다.

게시판 하단에는 

코멘트를 

include_once("./view_comment_3.php");

include_once("./view_comment_4.php");

 

이렇게 두개를 불러와서 

출력 할려고 합니다.

 

--------------------------------

 

코멘트 작성시

wr_1 =1   은 문의

wr_1 =2   는 신청

으로 해서 코멘트를 받고

 

include_once("./view_comment_3.php");

노출울 할려고하는데요..

 

$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply ";
 

에서 wr_1 값이 1 인값만 불러와서 리스트 출력을 할려고 합니다.

아래는 view_comment_3.php 입니다.

and wr_1 = 1 order by wr_comment desc, wr_comment_reply

 

이렇게 해도안되네요.. 하는방법이 있을까요?

 

 

 

 


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
@include_once("$board_skin_path/view_comment.head.skin.php");
include_once ("./norobot.inc.php");
if ($is_admin && !$token) 
{
    set_session("ss_delete_token", $token = uniqid(time()));
}
$list = array();
$is_comment_write = false;
if ($member[mb_level] >= $board[bo_comment_level]) 
    $is_comment_write = true;
 
// 코멘트 출력 순서
$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) 
{
    $list[$i] = $row;
    //$list[$i][name] = get_sideview($row[mb_id], cut_str($row[wr_name], 20, ''), $row[wr_email], $row[wr_homepage]);
    $tmp_name = get_text(cut_str($row[wr_name], $config[cf_cut_name])); // 설정된 자리수 만큼만 이름 출력
    if ($board[bo_use_sideview])
        $list[$i][name] = get_sideview($row[mb_id], $tmp_name, $row[wr_email], $row[wr_homepage]);
    else
        $list[$i][name] = "<span class='".($row[mb_id]?'member':'guest')."'>$tmp_name</span>";

    
    $list[$i][content] = $list[$i][content1]= "비밀글 입니다.";
    if (!strstr($row[wr_option], "secret") ||
        $is_admin || 
        ($write[mb_id]==$member[mb_id] && $member[mb_id]) || 
        ($row[mb_id]==$member[mb_id] && $member[mb_id])) {
        $list[$i][content1] = $row[wr_content];
        $list[$i][content] = conv_content($row[wr_content], 0, 'wr_content');
        $list[$i][content] = search_font($stx, $list[$i][content]);
    }
    $list[$i][trackback] = url_auto_link($row[wr_trackback]);
    $list[$i][datetime] = substr($row[wr_datetime],2,14);
    // 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
    $list[$i][ip] = $row[wr_ip];
    if (!$is_admin)
        $list[$i][ip] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $row[wr_ip]);
    $list[$i][is_reply] = false;
    $list[$i][is_edit] = false;
    $list[$i][is_del]  = false;
    if ($is_comment_write || $is_admin) 
    {
        if ($member[mb_id]) 
        {
            if ($row[mb_id] == $member[mb_id] || $is_admin) 
            {
                $list[$i][del_link]  = "./delete_comment.php?bo_table=$bo_table&comment_id=$row[wr_id]&token=$token&cwin=$cwin&page=$page".$qstr;
                $list[$i][is_edit]   = true;
                $list[$i][is_del]    = true;
            }
        } 
        else 
        {
            if (!$row[mb_id]) {
                $list[$i][del_link] = "./password.php?w=x&bo_table=$bo_table&comment_id=$row[wr_id]&cwin=$cwin&page=$page".$qstr;
                $list[$i][is_del]   = true;
            }
        }
        if (strlen($row[wr_comment_reply]) < 5)
            $list[$i][is_reply] = true;
    }

    if ($i > 0 && !$is_admin)
    {
        if ($row[wr_comment_reply]) 
        {
            $tmp_comment_reply = substr($row[wr_comment_reply], 0, strlen($row[wr_comment_reply]) - 1);
            if ($tmp_comment_reply == $list[$i-1][wr_comment_reply])
            {
                $list[$i-1][is_edit] = false;
                $list[$i-1][is_del] = false;
            }
        }
    }
}
//  코멘트수 제한 설정값
if ($is_admin)
{
    $comment_min = $comment_max = 0;
}
else
{
    $comment_min = (int)$board[bo_comment_min];
    $comment_max = (int)$board[bo_comment_max];
}
include_once("$board_skin_path/view_comment_3.skin.php");
// 필터
//echo "<script type='text/javascript'> var g4_cf_filter = '$config[cf_filter]'; </script>\n";
//echo "<script type='text/javascript' src='$g4[path]/js/filter.js'></script>\n";
if (!$member[mb_id]) // 비회원일 경우에만
    echo "<script type='text/javascript' src='$g4[path]/js/md5.js'></script>\n";
@include_once("$board_skin_path/view_comment.tail.skin.php");
?>

이 질문에 댓글 쓰기 :

답변 2

코멘트 작성시 wr_1을 받았다면 그냥 단순히
view_comment.skin.php 출력 부분을 아래처럼 하면 되지않나요?
제가 잘못 이해한건가요?

 

<?php if($list[$i]['wr_1'] == "1") { ?>
<article ....
</article>
<?php } ?>

답변감사합니다. 위방법도 해봤는데요...
php if($list[$i]['wr_1'] == "1" 사용하게 되면 출력을 못하더라구요.
그래서 차라리 DB 쪽에서 WR_1 1값이 db만 읽어드릴려고 햇었거든요.~

select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply

에서 잘못된부분은 없을까요?

답변을 작성하시기 전에 로그인 해주세요.
전체 87
QA 내용 검색

회원로그인

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