테스트 사이트 - 개발 중인 베타 버전입니다

게시글 엑셀파일로 추출시 댓글도 출력되게... 채택완료

집에가고픈 10년 전 조회 3,440

</strong></p><p><strong><?

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

 

 

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

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

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

    요부분에 댓글이 떠야하는데.. 안떠요ㅠ 어떻게 해야할지 감도 안와서 질문남깁니다. 

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

답변 2개

채택된 답변
+20 포인트
Rido
10년 전

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

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

 

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

 

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

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

집에가고픈
10년 전
아이고, 바빠서 이제야 채택했네요, 알려주신 내용을 토대로 잘 해결했습니다 !!
ㅋㅋㅋ분위기좋을때 넌지시 이야기는 해봤습니다만........... 과연... 두둥ㅋ

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

Rido
10년 전

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

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

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

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

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

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

로그인