채택완료

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

2015-05-29 (금) 15:23:38 3,605

Copy
<?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개 / 댓글 2개

채택된 답변
+20 포인트

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

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

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

Copy
<?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>​

답변에 대한 댓글 1개

2015-06-09 (화) 08:33:55
아이고, 바빠서 이제야 채택했네요, 알려주신 내용을 토대로 잘 해결했습니다 !!
ㅋㅋㅋ분위기좋을때 넌지시 이야기는 해봤습니다만........... 과연... 두둥ㅋ

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

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

답변에 대한 댓글 1개

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

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