최신 코멘트 불러올 때 글 제목도 불러오는 법!
최신 코멘트를 아래 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]?> 안나오더라구요.
어떤 글에 달린 코멘트인지 표시하고 싶은데 글제목까지 나오게 하는 법은 없을까요??
댓글 2개
12년 전
일단 제목 필드는 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];
}
이런식으로 받으시면 되겠습니다.
12년 전
$comment_row[wr_content]; -> $comment_row[wr_subject]; 로 변경해서 제목이 나오게까지는 했는데 제목이 모두 똑같이 나오네요 ㅜ
게시글 목록
| 번호 | 제목 |
|---|---|
| 284508 | |
| 284499 | |
| 284492 | |
| 284490 | |
| 284484 | |
| 284481 | |
| 284478 | |
| 284476 | |
| 284474 | |
| 284472 | |
| 284470 | |
| 284458 | |
| 284457 | |
| 284454 | |
| 284453 | |
| 284447 | |
| 284446 | |
| 284444 | |
| 284441 | |
| 284440 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기