채택완료

전체갯수에서 댓글갯수를 제외하려면...

2016-02-20 (토) 16:30:17 2,763

안녕하세요?

좋은 주말 되십시오~

<?php

  $total = sql_fetch("select count(*) as cnt  from g5_write_free_board"); 

  echo "".number_format($total[cnt])."";

?>

자유게시판 전체갯수를 출력하는 소스입니다.

 

여기에서 댓글갯수를 제외하려고 

echo "".number_format($total[cnt]-$comment[cnt]).""; 

이렇게 했더니 안 됩니다.

이렇게 저렇게 해도 잘 안 되는군요...ㅜ

 

위 코드를 어떻게 고쳐야 하는지요?

 

감사합니다.

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

이렇게 해보세요.

<?php

  $total = sql_fetch("select count(*) as cnt  from g5_write_qna1 where wr_is_comment = 0");

  echo "".number_format($total[cnt])."";

?>

답변에 대한 댓글 1개

아하~ 그렇군요~
역시 작은별님~^^)
감사합니다.

답변을 작성하려면 로그인이 필요합니다.