답변 3개
아래의 내용을 참고를 해보세요.
1. 댓글수 쿼리
SELECT
wr.*,
ca.ca_name,
COUNT(c.wr_id) AS cnt_comment
FROM
{$write_table} AS wr
LEFT JOIN {$comment_table} AS c ON wr.wr_id = c.wr_id AND c.wr_is_comment = 0
LEFT JOIN {$g5['board_category_table']} AS ca ON wr.ca_name = ca.ca_name
WHERE
wr.bo_table = '{$bo_table}'
AND wr.wr_is_comment = 0
GROUP BY
wr.wr_id
ORDER BY
wr.wr_num
2. 댓글수 표시
<?php if ($item['cnt_comment']) { ?>
<span class="sound_only">댓글</span>
<span class="cnt_cmt"><?php echo $item['cnt_comment']; ?></span>
<span class="sound_only">개</span>
<?php } ?>
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
<?php if ($list[$i]['comment_cnt']) { ?>
->
<?php if ($list[$i]['wr_comment']) { ?>
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인