스피드퀸1

그누보드 게시판

· 2013-12-11 (수) 15:09:35 · 1117 · 1
상세보기 페이지에서 이전글 옆에 이전글 제목과
다음글 옆에 다음글 제목을 출력하고 싶습니다. 어떻게 해야 하는지 궁금합니다.
// 윗글을 얻음
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num = '{$write['wr_num']}' and wr_reply < '{$write['wr_reply']}' {$sql_search} order by wr_num desc, wr_reply desc limit 1 ";
$prev = sql_fetch($sql);
// 위의 쿼리문으로 값을 얻지 못했다면
if (!$prev['wr_id']) {
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num < '{$write['wr_num']}' {$sql_search} order by wr_num desc, wr_reply desc limit 1 ";
$prev = sql_fetch($sql);
}

// 아래글을 얻음
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num = '{$write['wr_num']}' and wr_reply > '{$write['wr_reply']}' {$sql_search} order by wr_num, wr_reply limit 1 ";
$next = sql_fetch($sql);
// 위의 쿼리문으로 값을 얻지 못했다면
if (!$next['wr_id']) {
$sql = " select wr_id, wr_subject from {$write_table} where wr_is_comment = 0 and wr_num > '{$write['wr_num']}' {$sql_search} order by wr_num, wr_reply limit 1 ";
$next = sql_fetch($sql);
}
}
|

댓글 1개

2013-12-11 (수) 15:47:20
이전글 <?php echo $prev['wr_subject'] ?>
다음글 <?php echo $next['wr_subject'] ?>
이러면 되지않을까요?
댓글을 작성하시려면 로그인이 필요합니다.

그누5 질답

1,039건

그누보드5 버전에 대한 질문을 할 수 있습니다.쪽지나 메일로 해결해 주겠다는 답변은 정상적인 답변으로 보기 어려우므로 신고해 주시기 바랍니다.

+
제목 글쓴이 날짜 조회
13-12-13 조회 938
13-12-13 조회 1,339
13-12-13 조회 886
13-12-13 조회 749
13-12-13 조회 1,099
13-12-13 조회 913
13-12-12 조회 884
13-12-11 조회 1,636
13-12-11 조회 1,003
13-12-11 조회 984
13-12-11 조회 1,118
13-12-11 조회 682
13-12-11 조회 655
13-12-11 조회 559
13-12-11 조회 649
13-12-11 조회 659
13-12-10 조회 595
13-12-10 조회 704
13-12-10 조회 831
13-12-10 조회 651