최신 코멘트 불러올 때 글 제목도 불러오는 법! 정보
최신 코멘트 불러올 때 글 제목도 불러오는 법!본문
최신 코멘트를 아래 sql 구문을 써서 불러오고 있습니다.
$sql = " select * from $tmp_write_table where wr_is_comment = 1 order by wr_id desc limit 0, $rows ";
그런데 글제목은 <?=$list[$i][subject]?> 안나오더라구요.
어떤 글에 달린 코멘트인지 표시하고 싶은데 글제목까지 나오게 하는 법은 없을까요??
$sql = " select * from $tmp_write_table where wr_is_comment = 1 order by wr_id desc limit 0, $rows ";
그런데 글제목은 <?=$list[$i][subject]?> 안나오더라구요.
어떤 글에 달린 코멘트인지 표시하고 싶은데 글제목까지 나오게 하는 법은 없을까요??
댓글 전체
일단 제목 필드는 wr_content 이구요
가져오실려면
$sql = " select * from $tmp_write_table where wr_is_comment = 1 order by wr_id desc limit 0, $rows ";
$result = mysql_query($sql);
while ($row = sql_fetch_array($result))
{
$comment_row = sql_fetch(" select wr_content from $tmp_write_table where wr_id = '".$row[wr_parent]."' and wr_is_comment=0 ");
//부모글 제목
$parent_title = $comment_row[wr_content];
}
이런식으로 받으시면 되겠습니다.
가져오실려면
$sql = " select * from $tmp_write_table where wr_is_comment = 1 order by wr_id desc limit 0, $rows ";
$result = mysql_query($sql);
while ($row = sql_fetch_array($result))
{
$comment_row = sql_fetch(" select wr_content from $tmp_write_table where wr_id = '".$row[wr_parent]."' and wr_is_comment=0 ");
//부모글 제목
$parent_title = $comment_row[wr_content];
}
이런식으로 받으시면 되겠습니다.
$comment_row[wr_content]; -> $comment_row[wr_subject]; 로 변경해서 제목이 나오게까지는 했는데 제목이 모두 똑같이 나오네요 ㅜ