이거 아시는분 답변좀....

>
> 특정그룹에서 wr_subject = abcd 인 것이 몇개인지를 구하려고하는되 뭐가 잘못된것인지 ...
> 아시는분 수정좀 부탁드립니다
>
> <?
> $sql = " select a.bo_subject, a.bo_table, b.gr_subject
> from $cfg[table_board] a, $cfg[table_group] b
> where a.gr_id = b.gr_id AND b.gr_id = '그룹명'
> order by b.gr_id, a.bo_table ";
> $result = sql_query($sql);
> while ($row = mysql_fetch_array($result)) {
> $tbl = "{$cfg[write_table_prefix]}{$row[bo_table]}";
> $sql2 = " select count(*)
>
>
> from $tbl
> where wr_subject ='abcd' ";
>
> $result2 = sql_query($sql2);
>
>
> mysql_free_result($result2);
> }
> mysql_free_result($result);
> ?>
>
>
> <?=$result2[0]?>개입니다.
>
>
> 요렇게 해보았는데 안되는군요..
>
|

댓글 1개

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
define("_DOCTYPE_", "DESIGN");
?>

<?
$sql = "select a.bo_subject, a.bo_table, b.gr_subject
from $cfg[table_board] a, $cfg[table_group] b
where a.gr_id = b.gr_id AND b.gr_id = '그룹명'
order by b.gr_id, a.bo_table ";

$result = sql_query($sql);
while ($row = mysql_fetch_array($result)) {
$tbl = "{$cfg[write_table_prefix]}{$row[bo_table]}";
$sql2 = " select count(*)
from $tbl
where wr_subject = 'abcd' ";

$result2 = sql_fetch($sql2);

$board_count += $result2[0];

}
mysql_free_result($result);
?>

<?=$board_count?>개입니다.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누3질답

+
제목 글쓴이 날짜 조회
21년 전 조회 444
zzoony
21년 전 조회 468
21년 전 조회 368
21년 전 조회 588
21년 전 조회 575
21년 전 조회 564
21년 전 조회 421
21년 전 조회 420
21년 전 조회 460
21년 전 조회 437
21년 전 조회 449
21년 전 조회 531
21년 전 조회 389
21년 전 조회 477
21년 전 조회 3,847
21년 전 조회 694
21년 전 조회 735
21년 전 조회 475
21년 전 조회 412
21년 전 조회 506
🐛 버그신고