7쟁이님의 나의 최신글 스킨에서 한 그룹에서만 글을 뽑아 올 수는 없는지요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

7쟁이님의 나의 최신글 스킨에서 한 그룹에서만 글을 뽑아 올 수는 없는지요? 정보

7쟁이님의 나의 최신글 스킨에서 한 그룹에서만 글을 뽑아 올 수는 없는지요?

본문

7쟁이님의 나의 최신글 스킨을 사용하고 있는데 한 그룹에서만 최신글을 뽑아 오는
방법이 없는지요 초급이라 여러가지로 힘이듭니다.
매번 질문만 올리게 되어 부끄럽기도 하구요. 혹 알고 계시면 회원이 계시면 답변 주셨으면 합니다.
 
// 나의 최근게시물
 
if ($member[mb_id])
{
    $new_count = 5;
    $cnt = 0;
    $sql = " select bo_table, wr_parent from $g4[board_new_table] a
              where mb_id = '$member[mb_id]'
                -- and a.wr_id = a.wr_parent
                group by bo_table, wr_parent
                order by bn_id desc
                limit $new_count ";
    $res = sql_query($sql);
    echo "<table width=95% cellpadding=0 cellspacing=0 align=center>";
    echo "<tr height=25><td><img src='$g4[path]/my_view/img/list_icon.gif'> <span style='color:#333333;'><b>나의 최근게시물 </b></span></a></td></tr><tr><td height=1 bgcolor=#FF9900></td></tr>";
    for ($i=0; $row=sql_fetch_array($res), $i<$new_count; $i++)
    {
      
      
    
      
        if (!$row[bo_table])
        {
            continue;
        }
        $tmp_table = $g4[write_prefix].$row[bo_table];
        $sql2 = " select wr_subject, wr_comment from $tmp_table where wr_id = '$row[wr_parent]' ";
        $row2 = sql_fetch($sql2);
        $subj = get_text($row2[wr_subject]);
        $comment = "";
        if ($row2[wr_comment])
            $comment = "<span class=small>($row2[wr_comment])</span>";
        echo "<tr height=23><td class=bg_menu2 title='$subj'>";
        echo "<nobr style='display:block;overflow:hidden;width:160px;'>";
        echo "<img src='$g4[path]/my_view/img/list_icon2.gif'> <a href='$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row[wr_parent]'>";
        echo "<span style='color:#666666;'>$comment $subj</span></a>";
        echo "</nobr></td></tr>";
        $cnt++;
    }
    if (!$cnt)
        echo "<tr><td><span style='color:gray;'>게시글이 없습니다.</span></td></tr>";
    echo "</table>\n";
}
?> 
 

댓글 전체

$sql = " select bo_table, wr_parent from $g4[board_new_table] a
              where mb_id = '$member[mb_id]'
                -- and a.wr_id = a.wr_parent
                group by bo_table, wr_parent
                order by bn_id desc
                limit $new_count ";

==>

$sql = " select bo_table, wr_parent from $g4[board_new_table] a, $g4[board_table] b
              where a.bo_table = b.bo_table and b.gr_id = '###그룹 아이디 #####'
and mb_id = '$member[mb_id]'
                -- and a.wr_id = a.wr_parent
                group by bo_table, wr_parent
                order by bn_id desc
                limit $new_count ";


===

인덱스 추가해야 할 듯합니다.
아래와 같이 에러가 납니다. 그리고 제가 무지해서 그런데 인덱스를 추가 해야 한다는 의미는 무엇인지요?
 
 select bo_table, wr_parent from g4_board_new a, g4_board b where a.bo_table = b.bo_table and b.gr_id = 'apply' and mb_id = 'admin' -- and a.wr_id = a.wr_parent group by bo_table, wr_parent order by bn_id desc limit 5

1052 : Column: 'bo_table' in field list is ambiguous

error file : /board/bbs/member_confirm.php
$sql = " select bo_table, wr_parent from $g4[board_new_table] a, $g4[board_table] b
              where a.bo_table = b.bo_table and b.gr_id = '###그룹 아이디 #####'
and mb_id = '$member[mb_id]'
                -- and a.wr_id = a.wr_parent
                group by bo_table, wr_parent
                order by bn_id desc
                limit $new_count ";


여기서

b.gr_id = '###그룹 아이디 #####'

여기만

b.gr_id != '###그룹 아이디 #####'

로 바꾸면 됩니다.
고맙습니다. 얼른 적용해봐야겠네요.
^^ 친절한 답변감사드려요~~

$sql = " select a.bo_table, a.wr_parent from $g4[board_new_table] a, $g4[board_table] b
              where a.bo_table = b.bo_table and b.gr_id != '###그룹 아이디 #####'
and mb_id = '$member[mb_id]'
                -- and a.wr_id = a.wr_parent
                group by bo_table, wr_parent
                order by bn_id desc
                limit $new_count ";

잘됩니다.
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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