게시글 엑셀파일로 추출시 댓글도 출력되게...
본문
<?
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문으로 돌려줘야 할듯 하네요
답변을 작성하시기 전에 로그인 해주세요.