php로 게시판을 만들던 중, 리스트에서 해당 글의 코멘트 갯수 가져오기 하려고 할때 이렇게했음.

mysql>select count(*) as comment_counter from board where no = 3

쿼리문은 일단 이렇게

$comment_count_query = "SELECT count(*) as comment_counter FROM board WHERE no = 3"; $comment_sql = mysql_query($comment_count_query); $comment_row = mysql_fetch_array($comment_sql); $comment_count = $comment_row[comment_count]; <td><?= $comment_count ?></td>

이렇게 해주면 끝

+ Recent posts