다중게시판 최신글에서 답변이 해당글의 밑으로 가게 하려면?
다중게시판 최신글에서
답변인 글은 안나오거나, 해당글의 밑으로 내려가게 하고 싶습니다.
쿼리문을 어떻게 손보면 될까요? ㅠㅠ
부탁드립니다.
function latest_multi($skin_dir="", $bo_table1, $bo_table2, $bo_table3, $bo_table4, $bo_table5, $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";
$list = array();
$sql = " select * from $g4[board_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4','$bo_table5')
and a.wr_id = a.wr_parent
order by a.bn_id desc
limit $rows ";
답변인 글은 안나오거나, 해당글의 밑으로 내려가게 하고 싶습니다.
쿼리문을 어떻게 손보면 될까요? ㅠㅠ
부탁드립니다.
function latest_multi($skin_dir="", $bo_table1, $bo_table2, $bo_table3, $bo_table4, $bo_table5, $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";
$list = array();
$sql = " select * from $g4[board_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4','$bo_table5')
and a.wr_id = a.wr_parent
order by a.bn_id desc
limit $rows ";
|
댓글을 작성하시려면 로그인이 필요합니다.
댓글 4개
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4','$bo_table5')
and a.wr_id = a.wr_parent and b.wr_parent =b.wr_id
order by a.bn_id desc
limit $rows ";
===
and b.wr_parent =b.wr_id
위 조건식을 추가하시면 답변인글은 안나오게 되겠습니다.~
그런데.. 에러가 나네요 ..
1054 : Unknown column 'b.wr_parent' in 'where clause'
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4','$bo_table5')
and a.wr_id = a.wr_parent order by a.bn_id desc
limit $rows ";
앞에 and a.wr_id = a.wr_parent 조건문이 잇었네요 자세히 못보고 답변드려 죄송합니다
위 조건문은 본글만 나오게 하는 조건이라서 원래 올려주신 소스
$sql = " select * from $g4[board_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4','$bo_table5')
and a.wr_id = a.wr_parent
order by a.bn_id desc
limit $rows ";
이대로 쓰셔도 답변글은 안나오실꺼 같은데요..
한번 확인해보세요
wr_id 와 wr_parent 이같아요 ㅠㅠ
답글임에도 같네요..
리스트에서 원글을 찾는건 wr_num 을 보고 찾아요..
이럴경우는 어떻게 해야 하는지.. 난감하네요
원글과 답글의 wr_num이 같아요