게시판 리스트에서 댓글을 바로 보이게 하려는데요...

게시판 리스트에서 댓글을 바로 보이게 하려는데요...

QA

게시판 리스트에서 댓글을 바로 보이게 하려는데요...

답변 2

본문

3660971816_1595227944.0126.jpg

 

 

                        <!--2020-07-01 코멘트 노출 추가 -->

 

                        <div style="background-color:#e1e1e1; padding:10px;">

                        <?php

 $row=sql_fetch("select wr_name, wr_content from $write_table where wr_parent='{$list[$i][wr_id]}' and wr_is_comment = 1 order by wr_datetime desc");

 echo $row[wr_name].' / ';

 if($row[wr_content]) $comment=cut_str($row[wr_content],40);

 else $comment=' ';

                        ?>

                        <?=$comment?>

                       </div>

 

질문답변과 팁 자료에서 검색을 해서 위의 상태로 코드를 짰는데

댓글이 최신댓글 1개가 아닌 대략 5개 정도를 보이게 할려면 어디를 수정해야 할까요??

여러 고수님들의 의견이 필요합니다 ㅠ ㅠ 

이 질문에 댓글 쓰기 :

답변 2

$sql = " select wr_name, wr_content from $write_table where wr_parent='{$list[$i][wr_id]}' and wr_is_comment = 1 order by wr_datetime desc limit 5";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{  
   echo $row[wr_name].' / ';
   if($row[wr_content]) $comment=cut_str($row[wr_content],40);
   else $comment=' ';
   echo $comment;
   
}

 $row=sql_fetch("select wr_name, wr_content from $write_table where wr_parent='{$list[$i][wr_id]}' and rownum <= 5 order by wr_datetime desc");

 

이렇게 수정해보세요.

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