최근글 스킨에서 쿼리값이 없을때 정보
최근글 스킨에서 쿼리값이 없을때본문
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.
오류 주소 :
최근글을 사용하여 게시판에서 공지만 뽑아 표시되게 해주었습니다.
공지기간이 끝나 공지체크를 해제하였더니 메인에서 에러가 나네요..
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;
}
?>
오류 주소 :
최근글을 사용하여 게시판에서 공지만 뽑아 표시되게 해주었습니다.
공지기간이 끝나 공지체크를 해제하였더니 메인에서 에러가 나네요..
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]} )";
}
}
로 수정해보세요
$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
위의 소스를 짜실정도면 에러도 해결할정도가 되실거같아서요..
$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]} )";
}
다음 처럼 한 줄 추가 해 보세요.
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]} )";
}
답변감사합니다.
엑스엠엘님은 언제나 답변을 달아주시네요!
p.s. 코드 잘 쓰고있습니다~ ^^
엑스엠엘님은 언제나 답변을 달아주시네요!
p.s. 코드 잘 쓰고있습니다~ ^^