채택완료

카테고리 글수

2017-10-09 (월) 23:58:02 1,107

검색해서 공부해보니

<? 

$tmp_table= $g5[write_prefix].'abc'; 

$row = sql_fetch("select count(*) as cnt from $tmp_table where ca_name='접수'");

echo $row[cnt];

?>

이렇게 하니 뽑아올 수 있던데요,.,

문제는 접수카테고리에 글이 1개인데..왜 2개로 나오는 걸까요?

아래 팁을 적용해도

https://sir.kr/g5_tip/3185 

똑같이 글이 1개인데 2개로 나오는 이유를 모르겠어요,,

디비 조회해보니 복사로그 댓글이 있는데...

그것을 포함하니 2개로 나오네요..ㅋ

   if ($ca_name) $sql_where = " where ca_name = '".$ca_name."' ";

   else $sql_where = " where ca_name != '' ";

   $row = sql_fetch(" select count(*) as cnt from ".$g5['write_prefix'].$bo_table.$sql_where );  이 코드에서 댓글은 제외하려면 어떻게 해야 할가요? 

|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트
mySqlAdmin 이나
HeidiSql등 툴을 이용해서
g5_write_abc테이블의 컬럼을 보시면
is_comment 등이 있을겁니다

if ($ca_name) $sql_where = " where ca_name = '".$ca_name."' ";
else $sql_where = " where ca_name != '' ";

$sql_where .= " and wr_is_comment ='0' and wr_comment ='0' ";

$row = sql_fetch(" select count(*) as cnt from ".$g5['write_prefix'].$bo_table.$sql_where );

하시고 한번보세요



답변에 대한 댓글 1개

2017-10-10 (화) 10:00:51
번번이 감사합니다. 꾸벅,
$sql_where .= " and wr_is_comment ='0'"; 이렇게 하니 됩니다 ㅎ

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