GNUAPP

latest lib 카테고리 기능 문의 드려요.

latest 에서 카테고리와 검색기능을 불러오는 명령어입니다.(현님 제공)


function latest2($skin_dir="", $bo_table, $rows=10, $subject_len=40, $sca="", $sfl = "", $stx="" )
{
global $g4;

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

$list = array();
$sql_search = "";

$sql = " select * from {$g4['board_table']} where bo_table = '$bo_table'";
$board = sql_fetch($sql);

$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름]

if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
}

$sql = " select * from $tmp_write_table where wr_is_comment = 0 and $sql_search order by wr_num limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
}

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

return $content;
}



latest lib부분에서 sca에 값이 없을때(전체를 선택했을때), 아래와 같은 오류가 발생하는데
이유를 못찾겠어요.ㅜㅜ


select * from g4_write_oneroom where wr_is_comment = 0 and order by wr_num limit 0, 8

1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by wr_num limit 0, 8' at line 1

error file : /bbs/board.php
|

댓글 2개

if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
}

$sql = " select * from $tmp_write_table where wr_is_comment = 0 and $sql_search order by wr_num limit 0, $rows ";

=>

if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
$sql_search = "and ".$sql_search;
}

$sql = " select * from $tmp_write_table where wr_is_comment = 0 $sql_search order by wr_num limit 0, $rows ";


이렇게 바꿔보세요
아주 잘 됩니다. 최고에요! ㅎ 좋은 주말 되세요.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
13년 전 조회 850
13년 전 조회 1,773
13년 전 조회 991
13년 전 조회 738
13년 전 조회 1,690
13년 전 조회 742
13년 전 조회 1,034
13년 전 조회 700
13년 전 조회 2,542
13년 전 조회 832
13년 전 조회 2,915
13년 전 조회 808
13년 전 조회 755
13년 전 조회 950
13년 전 조회 1,524
13년 전 조회 1,224
13년 전 조회 862
13년 전 조회 886
13년 전 조회 996
13년 전 조회 951
🐛 버그신고