회원이 작성한 게시글 수로 추출이 가능한가요 ? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

회원이 작성한 게시글 수로 추출이 가능한가요 ? 정보

회원이 작성한 게시글 수로 추출이 가능한가요 ?

본문

오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.

오류 주소 :
예를 들어서 1개의 테이블 (게시판) 에서
한 mb_id가 쓴 게시글 수도 추출할 수 있을까요 ?

게시글 수를 view 페이지에 넣어보고 싶은데...ㅠ 감이 오지 않네요...

댓글 전체

list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) from $write_table where mb_id='$member[mb_id]' where wr_id != $wr_id and wr_is_comment = 0"));
하시면 코멘트를 제외한 게시글 수를 가지고 오실수 있습니다
<?
list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) from $write_table where mb_id='$member[mb_id]' where wr_id != $wr_id and wr_is_comment = 0"));
?>
이렇게 적용하니...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\APM_Setup\skin\board\test\view.skin.php on line 15 이렇게 나옵니다...
list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

제가 오타를 쳤네요

이렇게해보세요
select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0

이쿼리를 echo로 찍어보세요 값이 제대로 나오는지 확인해 보셔야 할듯 합니다.
회원이 작성한 게시글수를 가져와야되므로 이 코드 위에
if($member[mb_id]){
}

이렇게 예외처리 해주셔야합니다
<?list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0")); 
if($member[mb_id]){ 
ehco "{list($mtcount)}";
}
?>
이렇게 되야하나요?
<?
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

 ehco $mtcount;
}
?>

이렇게요
<?
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

echo "select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"; 
}
?>

이렇게 적어보았습니다.
select count(wr_id) as mtcount from g4_write_haru_story where mb_id='admin' and wr_id != 5 and wr_is_comment = 0
이렇게 나오네여 ㅠ
apmsetup을 사용해서 가상서버를 사용 중입니다.
127.0.0.1
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<div style="height:12px; line-height:1px; font-size:1px;">&nbsp;</div>

<!-- 게시글 보기 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0"><tr><td>


<div style="clear:both; height:30px;">
    <div style="float:left; margin-top:6px;">
    <img src="<?=$board_skin_path?>/img/icon_date.gif" align=absmiddle border='0'>
    <span style="color:#888888;">작성일 : <?=date("y-m-d H:i", strtotime($view[wr_datetime]))?></span>
    </div>
<div><?
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0")); 
}
?>  </div>
</div>
<?
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));
?>
여기까지는 에러가 없는것 같은데...출력이 나오지는 않습니다. ㅠ
제가 써드린 거에는 오류가 없는거 같은데요

<?
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

echo $mtcount;
 ?>

일케해서 출력값이 나오는지 확인해주세요
<?
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

echo $mtcount;
 ?> 이렇게 대입하면
Parse error: syntax error, unexpected $end in C:\APM_Setup\htdocs\congsarang\skin\board\haru_story\view.skin.php on line 178 ㅠ 죄송합니다...
제 계정에 올려서 확인해 봤는데 오류가 안나오는데요
 if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

 echo($mtcount);

 }
이렇게 출력해보시고 오류가 나오면
view.skin.php 소스를 전부다 줘보세요
<? if($member[mb_id]){ 
  list($mtcount) = mysql_fetch_array(mysql_query("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_id != $wr_id and wr_is_comment = 0"));

 echo($mtcount);

 } ?> 이렇게 하니까 나오는것 같습니다 ㅠ

게시글 수 가 5개면 4개로 나옵니다 ㅠ 정말 감사합니다.
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT