다른게시판 내용 불러오기? 채택완료
지율아빠
3년 전
조회 1,801
두개의 게시판이 있습니다.
- bo_table = aaa
- bo_table = bbb
이때 mb_id = 'test' 인 사람이 bbb에 쓴 가장 최근 게시물 제목을
aaa 게시판 리스트에 'test' 사람이 쓴 게시물에 보여주려고 합니다.
</p>
<p><?php
// aaa 게시판 리스트 뿌려주기
for ($i=0; $i < $list_cnt; $i++) { </p>
<p> </p>
<p>$row = sql_fetch(" select count(*) as cnt from g5_write_bbb where mb_id = '{$list[$i][mb_id]}'");</p>
<p>?></p>
<p><?php echo $row['subject'];?//bbb게시판에 쓴 제목></p>
<p> </p>
<p>
제가 쓴 건 이런식의 코드인데.... 뭐가 문제일까요?
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
답변에 대한 댓글 2개
�
지율아빠
3년 전
D
Dessi
3년 전
네~ 그리고 최근 게시물 하나이고 댓글은 제외해야 하면 정렬 필드와 조건문도 추가로 들어가야합니다.
$row = sql_fetch(" select count(*) as cnt from g5_write_bbb where mb_id = '{$list[$i][mb_id]}'
AND `wr_is_comment` = '0' ORDER by `wr_id` DESC ");
$row = sql_fetch(" select count(*) as cnt from g5_write_bbb where mb_id = '{$list[$i][mb_id]}'
AND `wr_is_comment` = '0' ORDER by `wr_id` DESC ");
댓글을 작성하려면 로그인이 필요합니다.
3년 전
최근 게시물이라고 해놓고 추출을 저렇게 하면 안되죠
</p>
<p> </p>
<p><span class="token variable">$row</span> <span class="token operator">=</span> <span class="token function">sql_fetch</span><span class="token punctuation">(</span><span class="token double-quoted-string string">" select wr_subject from g5_write_bbb where wr_is_comment=0 and mb_id = '<span class="token interpolation"><span class="token punctuation">{</span><span class="token variable">$list</span><span class="token punctuation">[</span><span class="token variable">$i</span><span class="token punctuation">]</span><span class="token punctuation">[</span>mb_id<span class="token punctuation">]</span><span class="token punctuation">}</span></span>' order by wr_num"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></p>
<p><span class="token punctuation">
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
감사합니다. DEssi님..