최근글 스킨에서 쿼리값이 없을때 > 그누4 질문답변

그누4 질문답변

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

최근글 스킨에서 쿼리값이 없을때 정보

최근글 스킨에서 쿼리값이 없을때

본문

오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.

오류 주소 :


최근글을 사용하여 게시판에서 공지만 뽑아 표시되게 해주었습니다.
공지기간이 끝나 공지체크를 해제하였더니 메인에서 에러가 나네요..

1065 : Query was empty

error file : /bbs/main.php

쿼리값이 없을때 아무것도 표시 안하도록 하려면 어떤코드를 추가해줘야 하나요?


------------------------------------------------------latest_notice.php---------------------------------------------------

<?php
if (!defined('_GNUBOARD_')) exit;

// 최신글 추출
function quoting(&$item1, $key) { $item1 = "'$item1'"; }
function latest_notice($skin_dir="", $bo_tables, $rows=10, $subject_len=40, $options="") {

    global $g4;

    if ($skin_dir)
        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
    else
        $latest_skin_path = "$g4[path]/skin/latest/basic";

    if( !is_array( $bo_tables)) return 'A second parameter error:bo_tables should be an array.';

    array_walk( $bo_tables , 'quoting');
    $bo_tables_cond= implode(',', $bo_tables);
    $notice_res= sql_query( "select bo_table, bo_notice from {$g4['board_table']} where bo_table in ( $bo_tables_cond ) " );

    $notice_wr_id_cond=array();
    $notice_bo_tables=array();

    while( $row= sql_fetch_array( $notice_res)) {
        $this_notice= trim($row['bo_notice']);
        if( empty( $this_notice)) continue;
        $notice_wr_id_cond[]= implode( ',', split("\n", $this_notice));
        $notice_bo_tables[]= $row['bo_table'];
    }

    $sqls= array();

    foreach( $notice_bo_tables as $idx => $notice_bo_table) {
        $sqls[]= " select wr_id , wr_subject from {$g4['write_prefix']}$notice_bo_table where wr_id in ( {$notice_wr_id_cond[$idx]} )";
    }

    $list = array();

    $result = sql_query( implode( ' union all ', $sqls));
    for ($i=0; ($row = sql_fetch_array($result)) && $i < $rows; $i++)
        $list[$i] = get_list($row, array( 'bo_table'=>$notice_bo_table), $latest_skin_path, $subject_len);

    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}
?>

댓글 전체

foreach( $notice_bo_tables as $idx => $notice_bo_table) {
        $sqls[]= " select wr_id , wr_subject from {$g4['write_prefix']}$notice_bo_table where wr_id in ( {$notice_wr_id_cond[$idx]} )";
    }




if( is_array($notice_bo_tables) )
{
  foreach( $notice_bo_tables as $idx => $notice_bo_table) {
        $sqls[]= " select wr_id , wr_subject from {$g4['write_prefix']}$notice_bo_table where wr_id in ( {$notice_wr_id_cond[$idx]} )";
    }
}

로 수정해보세요
제가 위에서 답변 달았던 부분은 그대로 적용시켜 두시고..

$result = sql_query( implode( ' union all ', $sqls));



if( $sqls ) $result = sql_query( implode( ' union all ', $sqls));  로 수정해보세요


궁금한게 있는데 올려주신 소스는 직접 짜신건가요?  l

위의 소스를 짜실정도면 에러도 해결할정도가 되실거같아서요..
제가 아직 저런 코드를 직접 짤 능력이 안되어 여기저기서 가져다가 쓰고있습니다 ;;
말씀하신대로 수정해주었더니 해결되었네요.. 감사합니다 ^^
제가 팁란에 올렸던 코드군요. - -;
다음 처럼 한 줄 추가 해 보세요.

foreach( $notice_bo_tables as $idx => $notice_bo_table) {
        if( empty( trim( $notice_bo_table)) continue;
        $sqls[]= " select wr_id , wr_subject from {$g4['write_prefix']}$notice_bo_table where wr_id in ( {$notice_wr_id_cond[$idx]} )";
    }
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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