댓글 등록시 여분필드 wr_4에 특정글을 입력하게 했습니다. (입력 안된것도 있습니다)
wr_4에 입력된 개수를 출력할수없을까요?
아래의 root님 팁으로 어떻게 해볼려고하니 초보라서 안되어서요.
아시는분 도움 좀 부탁드립니다.
<?
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4='$view[wr_4]' and wr_id = $wr_id";
$row=sql_fetch($sql);
$scrap_count=$row[cnt];
?>
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : $scrap_count"; ?>
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4='$view[wr_4]' and wr_id = $wr_id";
$row=sql_fetch($sql);
$scrap_count=$row[cnt];
?>
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : $scrap_count"; ?>
root님 현재글 출력팁
<?
// 현재글의 스크랩 카운트를 구한다
$sql = "select count(*) as cnt from $g4[scrap_table] where bo_table='$bo_table' and wr_id = $wr_id";
$row=sql_fetch($sql);
$scrap_count=$row[cnt];
?>
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : $scrap_count"; ?>
// 현재글의 스크랩 카운트를 구한다
$sql = "select count(*) as cnt from $g4[scrap_table] where bo_table='$bo_table' and wr_id = $wr_id";
$row=sql_fetch($sql);
$scrap_count=$row[cnt];
?>
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : $scrap_count"; ?>
|
답변 4개 / 댓글 3개
채택된 답변
+20 포인트
2014-01-19 (일) 09:49:12
$g4[bo_table]은 뭔가요? 그런 g4변수는 없습니다
아래처럼 해보세요
scrap_count=$row[cnt];
답변에 대한 댓글 1개
2014-01-19 (일) 14:26:31
2018-11-03 (토) 21:09:00
많은 도움이 되었습니다. 감사합니다.
2014-01-18 (토) 23:13:56
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : ".$scrap_count; ?>
답변에 대한 댓글 1개
2014-01-19 (일) 00:16:16
히어1님 답글 감사합니다.
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4 !='' and wr_id = '$wr_id'";
문제는 여기서 에러가 납니다.
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4 !='' and wr_id = '$wr_id'";
문제는 여기서 에러가 납니다.
2014-01-18 (토) 21:55:26
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4 !='' and wr_id = '$wr_id'";
답변에 대한 댓글 1개
2014-01-18 (토) 22:12:11
슈와이님 답글 감사합니다.
근데 에러가 나네요.
이렇게가 맞는지요?
<?
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4 !='' and wr_id = '$wr_id'";
$row=sql_fetch($sql);
$scrap_count=$row[cnt];
?>
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : $scrap_count"; ?>
근데 에러가 나네요.
이렇게가 맞는지요?
<?
$sql = "select count(*) as cnt from $g4[bo_table] where wr_4 !='' and wr_id = '$wr_id'";
$row=sql_fetch($sql);
$scrap_count=$row[cnt];
?>
<? if($scrap_count > 0) echo "이글의 스크랩 카운트 : $scrap_count"; ?>
답변을 작성하려면 로그인이 필요합니다.
덕분에 잘 해결되었습니다.
정말 감사합니다^^