리스트에서 댓글 출력
본문
아래 쿼리는 뷰페이지에서 댓글 출력하는 코드인데요
리스트에서 각 게시글에 해당되는 댓글이 출력 되려면
어떻게 수정해야 될까요
// 코멘트 출력
//$sql = " select * from {$write_table} where wr_parent = '{$wr_id}' and wr_is_comment = 1 order by wr_comment desc, wr_comment_reply ";
$sql = " select * from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
}
답변 3
똑같이 출력 된다는 것은 코드를 넣은 위치가 맞지않아서겠죠
코드 넣을 때 게시물 마다 댓글 출력 마지막 부분에 unset($list2); 넣으세요
lisk.skin.php 파일의
for ($i=0; $i<count($list); $i++) { 문 아래에
$ex_wr_id = $list[$i][wr_id];
$sql = " select * from $write_table where wr_parent = '$ex_wr_id' and wr_is_comment = 1 order by wr_comment, wr_comment_reply ";
이런 식으로 불러오고 추가로 코딩해야 될것 같은데요
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row; ----> $list2[$i] = $row;
댓글 출력은 $list2를 사용