채택완료

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

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='&nbsp;';
//

 

이렇게 추가하고

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

 

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

|

답변 2개

채택된 답변
+20 포인트

$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");

 

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

select wr_content 뒤에 , mb_1 추가하시고 $row['mb_1'] 로 사용하시면 됩니다. 

답변을 작성하려면 로그인이 필요합니다.