게시글 엑셀파일로 추출시 댓글도 출력되게...

게시글 엑셀파일로 추출시 댓글도 출력되게...

QA

게시글 엑셀파일로 추출시 댓글도 출력되게...

본문


<?
header("Content-Disposition: attachment; filename=file.xls");
header("Content-Description: PHP4 Generated Data");
include "_common.php";
if($_POST['chk_wr_id']) {
 $in = implode(", ", $_POST['chk_wr_id']);
 $where = "WHERE wr_id  IN($in)";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<table border="1">
 <tr>
  <th>번호</th>
  <th>내용</th>
  <th>댓글</th>
 </tr>
<?
$no = 1; 
$que = sql_query("SELECT * FROM g4_write_".$_POST['bo_table']." ".$where." ORDER BY wr_id ASC"); 
while($row = sql_fetch_array($que)) {

 $str = $list[$i][content]; // 이게 아닌듯?!
?>
 <tr>
  <td><?=$no?></td>
  <td><?=$row['wr_content']?></td>
  <td><?=$str?></td> 

 </tr>
<? 
 $no++;
} 
?> 
</table>
​
 

 

 

요런 소스로 엑셀파일 추출하는 기능을 사용하고 있는데요,

글 1번에 댓글이 있을 경우, 엑셀 마지막 칸에 댓글이 뜨게 하려면 어떻게 해야하나요?

그냥 코멘트 skin 가서 변수 끌어왔는데;; 이런 간단한 방법은 아닌가보네요;

  <td><?=$str?></td>  요부분에 댓글이 떠야하는데.. 안떠요ㅠ 어떻게 해야할지 감도 안와서 질문남깁니다. 

이 질문에 댓글 쓰기 :

답변 2

흠.. 일단 잘 될지는 모르겠지만 

간단하게 수정해서 올려드립니다.

 

전에도 말씀드렸지만 웬만하면 프로그래머를 뽑으세요 ㅋㅋ

 


 
<?
header("Content-Disposition: attachment; filename=file.xls");
header("Content-Description: PHP4 Generated Data");
include "_common.php";
if($_POST['chk_wr_id']) {
 $in = implode(", ", $_POST['chk_wr_id']);
 $where = "WHERE wr_id  IN($in)";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<table border="1">
 <tr>
  <th>번호</th>
  <th>내용</th>
  <th>댓글</th>
 </tr>
<?
$no = 1; 
$que = sql_query("SELECT * FROM g4_write_".$_POST['bo_table']." ".$where." ORDER BY wr_id ASC"); 
while($row = sql_fetch_array($que)) {
 
// $str = $list[$i][content]; // 이게 아닌듯?!
?>
 <tr>
  <td><?=$no?></td>
  <td><?=$row['wr_content']?></td>
  <td>
    <?php
      $que2 = sql_query("select * from g4_write_".$_POST['bo_table']." ".$where." and wr_is_comment = 1 and wr_parent = ". $row['wr_id'] ." ORDER BY wr_id ASC"); 
      while ($row2 = sql_fetch_array($que2)) {
	echo $row2['wr_content']."<br>";
      }
    ?>
  </td> 
 
 </tr>
<? 
 $no++;
} 
?> 
</table>
​ 
 

지금소스로는 뽑아오기 힘들듯 하구요...

댓글을 불러오는 쿼리를 하나더 돌려서 다시 while문으로 돌려줘야 할듯 하네요

아ㅠㅠㅠ 그런가요,
$que = sql_query("SELECT * FROM g4_write_".$_POST['bo_table']." ".$where." ORDER BY wr_id ASC"); 
while($row = sql_fetch_array($que))
요거 참고해서 요렇게 두줄만 따로 추가하면 되는건가요? 쿼리랑 와일문ㅠㅠㅠ 젤 자신없는ㅠ

답변을 작성하시기 전에 로그인 해주세요.
전체 13
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT