가장 마지막에 쓴 코멘트를 리스트로 가져오기 -> 변형문의

가장 마지막에 쓴 코멘트를 리스트로 가져오기 -> 변형문의

QA

가장 마지막에 쓴 코멘트를 리스트로 가져오기 -> 변형문의

답변 2

본문

list.php에서

 

for ($i=0; $i<count($list); $i++)  {
  //리스트에 댓글 추가
 $row=sql_fetch("select wr_content from $write_table where wr_parent='{$list[$i][wr_id]}' and wr_is_comment = 1 order by wr_datetime desc limit 1");
if($row[wr_content]) $comment=cut_str($row[wr_content],30);else $comment=' ';
//

 

이렇게 추가하고

<?=$comment?> 로 해당글의 최근 댓글을 불러왔는데요.

 

댓글내용이 아닌 댓글작성자의 특정필드(mb_1)을 불러오려면 어떻게해야하나요? 

이 질문에 댓글 쓰기 :

답변 2

$row=sql_fetch("select (select mb_1 from g5_member where mb_id=a.mb_id) as mb_1 from $write_tablewhere wr_parent='{$list[$i][wr_id]}' and wr_is_comment = 1 order by wr_datetime desc limit 1");

 

이런식으로 하시면 됩니다.

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 91
© SIRSOFT
현재 페이지 제일 처음으로