묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
DB 내용 엑셀출력할때 문제.. (내용수정!!!)
2013.03.28 15:32
DB에 저장된 내용중 게시물 제목, 작성자, 작성일 그리고 해당 게시물의 확장변수를 엑셀로 출력시키는 php문서를 만드는중에
제가 의도하는 출력방식은
제목, 작성자, 작성일, 확장변수1, 확장변수2, 확장변수3 이렇게 출력이되어야 하는데
출력은 되나
같은 내용이 3번 반복되어서 출력되어 버립니다. 확장변수가 세로로배열되서 생기는 문제 이지요..
php 실력이 초보인지라 여러가지로 시도해보았는데 저로서는 원인을 모르겠어서 조언을 구하고자 질문 남깁니다.
<?
$info = array(
"host" => "",
"user" => "",
"pass" => "",
"db" => "",
"table" => "xe_documents",
"table1" => "xe_document_extra_vars"
);
$getFields = array("title","nick_name","regdate","value");
$stamp = mktime(); $str = date("Y년 m월 d일", $stamp);
$stamp = mktime(); $fileout = date("Ymd", $stamp);
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$fileout.xls");
$con = mysql_connect($info[host], $info[user], $info[pass]) || die(mysql_error());
mysql_query("set names utf8");
$con_db = mysql_select_db($info[db]) || die(mysql_error());
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table border=1>
<tr>
<td>항목A</td>
<td>항목B</td>
<td>항목C</td>
<td>항목D</td>
<td>항목E</td>
<td>항목F</td>
<td>항목G</td>
<td>항목H</td>
<td>항목I</td>
<td>항목J</td>
<td>항목K</td>
<td>항목L</td>
<td>항목M</td>
</tr>
<?
$result=mysql_query("select * from $info[table] as A, $info[table1] as B where A.module_srl=B.module_srl and A.document_srl=B.document_srl and A.module_srl='모듈번호' and B.var_idx order by A.document_srl, regdate desc");
while( $data = mysql_fetch_assoc($result) ){
echo"<tr>";
foreach( $data as $key => $val )
{
if( in_array($key, $getFields) ) echo "<td>".htmlspecialchars($val)."</td>";
}
echo"</tr>";
}
?>
</table>
</body>
</html>
$info = array(
"host" => "",
"user" => "",
"pass" => "",
"db" => "",
"table" => "xe_documents",
"table1" => "xe_document_extra_vars"
);
$getFields = array("title","nick_name","regdate","value");
$stamp = mktime(); $str = date("Y년 m월 d일", $stamp);
$stamp = mktime(); $fileout = date("Ymd", $stamp);
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$fileout.xls");
$con = mysql_connect($info[host], $info[user], $info[pass]) || die(mysql_error());
mysql_query("set names utf8");
$con_db = mysql_select_db($info[db]) || die(mysql_error());
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table border=1>
<tr>
<td>항목A</td>
<td>항목B</td>
<td>항목C</td>
<td>항목D</td>
<td>항목E</td>
<td>항목F</td>
<td>항목G</td>
<td>항목H</td>
<td>항목I</td>
<td>항목J</td>
<td>항목K</td>
<td>항목L</td>
<td>항목M</td>
</tr>
<?
$result=mysql_query("select * from $info[table] as A, $info[table1] as B where A.module_srl=B.module_srl and A.document_srl=B.document_srl and A.module_srl='모듈번호' and B.var_idx order by A.document_srl, regdate desc");
while( $data = mysql_fetch_assoc($result) ){
echo"<tr>";
foreach( $data as $key => $val )
{
if( in_array($key, $getFields) ) echo "<td>".htmlspecialchars($val)."</td>";
}
echo"</tr>";
}
?>
</table>
</body>
</html>
댓글 0
글쓴이 | 제목 | 최종 글 |
---|---|---|
XE | 공지 글 쓰기,삭제 운영방식 변경 공지 [16] | 2019.03.05 by 남기남 |
verysery | 다운로드 권한에 대해서 | |
커타야치 | write_form에 input을 추가했는데 입력이 안되요... ㅜㅜ | |
converseed | 안드로이드 어플에서 xe 게시물 등록 시 | |
해피신 | DB 내용 엑셀출력할때 문제.. (내용수정!!!) | |
nugul | IP주소 출력 안되게 할 수없나요? [1] | 2013.03.28 by SCAC |
허당마스터 | 하나 더.. 욕먹을 각오하고 씁니다. ㅠ [1] | 2013.03.28 by 똑디 |
허당마스터 | ShopXE 모듈 사용시 문제.. 궁금합니다. ㅠ [1] | 2013.03.28 by Fidelity |
sohorang | 기본 카운터의 total수가 갱신되지 않네요. [2] | 2013.03.28 by sohorang |
safddsf | 텍스타일 카테고리 문의 | |
박선훈537 | placeholder 삽입하려고 합니다. [4] | 2020.03.14 by BNU |
pmarch | 버전관련입니다 [1] | 2013.03.28 by 독도2005 |
그누와엑스이 | [사진有] 현재접속자위젯. [2] | 2013.03.28 by 몽실아빠 |
한닥터 | 게시글 관리용 checkbox를 넣어야 하는데.. 잘 안되네요. [1] | 2013.03.28 by KANTSOFT |
라시야 | 관리자 오류... | |
비밀얌 | 1.7.3 업데이트 후 로그인 안되고 404에러 (@윈컴이님 테마) [1] | 2013.03.28 by 비밀얌 |
암지 | 다음뷰 애드온 문의 | |
띵똥 | xpresseditor에 있는 이모티콘을 바꾸고 싶은데요 [1] | 2013.03.28 by 송동우 |
fafefaefe | 방문자수 질문입니다. | |
tiram2sue | 시간대별로 배경이미지 자동변경 하기~ [1] | 2013.03.28 by pentopen |
Bestios | 회원 삭제가 안됩니다. [2] | 2013.03.27 by chansol |