최신글 하나에 게시판 두개 출력 하는 방법
본문
안녕하세요
최신글 불러올 때 두개의 게시판에서 가져오고 싶은데 어떻게 하나요?
latest.lib 함수 를 수정하면 될것같은데
예전에 그누보드4 게시판에 이런 질문 올라와서 참고하려고 해도
조금 달라서 어렵네요.
도와주시면 감사하겠습니다.
답변 1
$sql_data = "select * from g5_write_table where wr_is_comment=0 union all ";
$sql_data .= "select * from g5_write_table where wr_is_comment=0 ";
$sql_data .= " order by wr_id desc limit 10";
$res_data = mysql_query($sql_data);
while ($row_data = mysql_fetch_array($res_data)) {
echo $row_data ['wr_subject'];
}
lib 파일 건드리는것보단 union all 사용하셔서 쿼리로 돌리는거 추천드려요
!-->
답변을 작성하시기 전에 로그인 해주세요.