채택완료

비밀글 옵션 추가

2014-08-02 (토) 15:49:33 5,333
Copy
function co_latest($skin_dir="basic", $rows=10, $subject_len=40, $gr_id=""){    global $config, $g4, $member;    $list = array(); $co_latest_skin_path = "$g4[path]/skin/co_latest/$skin_dir"; if ($gr_id)  $sql_common = " and b.gr_id = '$gr_id' "; // 같은 부모글은 글은 불러오지않음 bo_use_search 체크시만 표현    $sql = " select a.bo_table as bo_table, a.wr_id as wr_id, a.wr_parent as wr_parent from $g4[board_new_table] a, $g4[board_table] b where a.bo_table = b.bo_table and a.wr_id <> a.wr_parent and b.bo_use_search = '1' $sql_common order by a.bn_datetime desc limit 0, $rows"; $result = sql_query($sql);    for ($i=0; $row = sql_fetch_array($result); $i++){     $tmp_table = $g4['write_prefix'] . $row[bo_table]; // 게시판 테이블        $sql_table = " select wr_id, wr_subject, wr_option, wr_content, wr_comment, wr_parent, wr_datetime, wr_last, wr_homepage, wr_name, wr_reply, wr_link1, wr_link2, ca_name, wr_hit from $tmp_table where wr_id = '$row[wr_id]' ";        $row_table = sql_fetch($sql_table);        $sql_board = " select bo_table, bo_notice, bo_subject, bo_subject_len, bo_use_list_content, bo_new, bo_use_sideview, bo_use_comment, bo_hot, bo_use_search from $g4[board_table] where bo_table = '$row[bo_table]'";        $row_board = sql_fetch($sql_board);        $list[$i] = get_list($row_table, $row_board, $co_latest_skin_path, $subject_len); }

비밀글만 불러오려고 하는데

and wr_option != 'secret' 이걸 어느 부분에 추가해야하나요?

무작정 추가해보니 오류가 떠서요.

|

답변 2개

채택된 답변
+20 포인트

13행 마지막 수정 (wr_option에 secret만 저장되는 것이 아니므로 wr_option='secret' 해서는 안되는 경우가 있음)

where wr_id = '$row[wr_id]' and INSTR(wr_option,'secret')

14행 다음 줄에 추가

if( !$row_table[wr_id])continue; 

13라인 where wr_id = '$row[wr_id]'​를

where wr_id = '$row[wr_id]' and ​wr_option = 'secret'​ ";으로 해 보세요.


 

답변을 작성하려면 로그인이 필요합니다.