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 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12-12-15 조회 1,651
12-12-15 조회 954
12-12-15 조회 873
12-12-15 조회 2,023
12-12-15 조회 1,645
12-12-15 조회 946
12-12-15 조회 1,085
12-12-15 조회 977
12-12-15 조회 1,921
12-12-15 조회 1,115
12-12-15 조회 866
12-12-15 조회 1,827
12-12-15 조회 870
12-12-15 조회 1,175
12-12-15 조회 830
12-12-15 조회 2,687
12-12-15 조회 977
12-12-15 조회 3,087
12-12-15 조회 929
12-12-15 조회 883