회원이 작성한 게시글 수로 추출이 가능한가요 ? 정보
회원이 작성한 게시글 수로 추출이 가능한가요 ?
본문
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.
오류 주소 :
예를 들어서 1개의 테이블 (게시판) 에서
한 mb_id가 쓴 게시글 수도 추출할 수 있을까요 ?
게시글 수를 view 페이지에 넣어보고 싶은데...ㅠ 감이 오지 않네요...
오류 주소 :
예를 들어서 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) 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"));
제가 오타를 쳤네요
이렇게해보세요
제가 오타를 쳤네요
이렇게해보세요

말씀하신대로 하니, 에러는 사라졌지만 값이 출력되지 않습니다.
현재 view.skin.php에 적용중이라 그런가요 ?
아니면 ㅠㅠ
현재 view.skin.php에 적용중이라 그런가요 ?
아니면 ㅠㅠ

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]){
}
이렇게 예외처리 해주셔야합니다
이쿼리를 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]){
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"));
ehco $mtcount;
}
?>
이렇게요

Parse error: syntax error, unexpected T_VARIABLE in C:\APM_Setup\htdocs\congsarang\skin\board\haru_story\view.skin.php on line 19
ㅠㅠ 뭐가 문제일까요 ㅠ
ㅠㅠ 뭐가 문제일까요 ㅠ

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";
이렇게 찍어서 나오는 값을 적어주세요
이렇게 찍어서 나오는 값을 적어주세요

<?
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
이렇게 나오네여 ㅠ
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;"> </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>
127.0.0.1
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<div style="height:12px; line-height:1px; font-size:1px;"> </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>

basic 스킨의 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"));
?>
여기까지는 에러가 없는것 같은데...출력이 나오지는 않습니다. ㅠ
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;
?>
일케해서 출력값이 나오는지 확인해주세요

<?
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;
?> 이렇게 대입하면
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);
}
이렇게 출력해보시고 오류가 나오면
view.skin.php 소스를 전부다 줘보세요

echo($mtcount+1);
이렇게 하니 완벽하게 작동합니다. 넓은마인드님 진심으로 감사드립니다.
이렇게 하니 완벽하게 작동합니다. 넓은마인드님 진심으로 감사드립니다.

<? 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개로 나옵니다 ㅠ 정말 감사합니다.
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개로 나옵니다 ㅠ 정말 감사합니다.

넵. 오류없이 잘되시면 채택해주세요.~
<? if($member[mb_id]){
list($mtcount) = sql_fetch("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_is_comment = 0");
echo($mtcount);
} ?>
list($mtcount) = sql_fetch("select count(wr_id) as mtcount from $write_table where mb_id='$member[mb_id]' and wr_is_comment = 0");
echo($mtcount);
} ?>

균이님 감사합니다 !