답변 3개
</p>
<p>update g5_board</p>
<p> set bo_count_write = (select count(*) from g5_write_게시판ID where wr_is_comment = 0)</p>
<p> where bo_table = '게시판ID'</p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
게시물을 insert하는 .php파일에서
해당 게시판의 글 개수를 조회하고
그 개수만큼 update하는 sql문을 실행하시면 되지않을까요?
댓글을 작성하려면 로그인이 필요합니다.
adm/"board_form_update.php"
// 글수 조정 if (isset($_POST['proc_count'])) { // 원글을 얻습니다. $sql = " select a.wr_id, (count(b.wr_parent) - 1) as cnt from {$g5['write_prefix']}{$bo_table} a, {$g5['write_prefix']}{$bo_table} b where a.wr_id=b.wr_parent and a.wr_is_comment=0 group by a.wr_id "; $result = sql_query($sql); for ($i=0; $row=sql_fetch_array($result); $i++) {
sql_query(" update {$g5['write_prefix']}{$bo_table} set wr_comment = '{$row['cnt']}' where wr_id = '{$row['wr_id']}' "); } }
부분 참고하시면 됩니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인