묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
특정 게시판 리스트를 엑셀파일로 출력 확장변수 까지 같이 출력 할려고 하는데...
2013.02.13 11:40
특정 게시판 리스트를 엑셀파일로 출력 확장변수 까지 같이 출력 할려고 하는데
아래처럼 하면 확장변수가 옆으로 안가고 아래로 가요 도와 주세요 -.-
<?php
$info = array(
"host" => "호스트",
"user" => "아이디",
"pass" => "비번",
"db" => "DB명",
"table" => "xe_documents",
"table1" => "xe_document_extra_vars",
"module_srl" => "1086",
);
$getFields = array("title","nick_name","regdate","ipaddress","user_id",); //출력원하는 칼럼을 배열로 입력
$getFields1 = array("value");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=documents.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());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=Content-Type content=text/html; charset="utf-8">
<style type="text/css">
.a {
color: #FD4E02;
font-weight: bold;
}
</style>
</head>
<body>
<table width="800" height="215" border="0" cellpadding="0" cellspacing="0"><tr>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle" class="a">12</td></tr></table>
<table border=1>
<tr align=center>
<?php
$fields = mysql_list_fields("$info[db]", "$info[table]");
$columns = mysql_num_fields($fields);
for( $i=0 ; $i<$columns ; $i++ )
{
$field[$i]=mysql_field_name($fields, $i);
if( in_array($field[$i], $getFields) ) echo "<th>".$field[$i]."</th>";
}
?>
</tr>
<?php
$result = mysql_query("select * from $info[table] where module_srl = $info[module_srl]");
while( $data = mysql_fetch_assoc($result) )
{
echo"<tr>";
foreach( $data as $key => $val )
{
if( in_array($key, $getFields) ) echo "<th>".htmlspecialchars($val)."</th>";
}
echo"</tr>";
}
?>
</table>
<td>
</td>
<td>
<table border=1>
<tr align=center>
<?php
$fields = mysql_list_fields("$info[db]", "$info[table1]");
$columns = mysql_num_fields($fields);
for( $i=0 ; $i<$columns ; $i++ )
{
$field[$i]=mysql_field_name($fields, $i);
if( in_array($field[$i], $getFields1) ) echo "<th>".$field[$i]."</th>";
}
?>
<?php
$result = mysql_query("select * from $info[table1] where module_srl = $info[module_srl]");
while( $data = mysql_fetch_assoc($result) )
{
echo"<tr>";
foreach( $data as $key => $val )
{
if( in_array($key, $getFields1) ) echo "<th>".htmlspecialchars($val)."</th>";
}
echo"</tr>";
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
댓글 0
글쓴이 | 제목 | 최종 글 |
---|---|---|
XE | 공지 글 쓰기,삭제 운영방식 변경 공지 [16] | 2019.03.05 by 남기남 |
KTK | 게시글 작성시 특정 단어 작성금지 [1] | 2013.02.13 by 송동우 |
윤씨 | 단축키 지정 문제.. (다시 올립니다.) [1] | 2013.02.13 by 푸시아 |
nimm | DB에 files 테이블에서요.. | |
켠 | 도와주세요! 댓글이 새로고침해야 등록이 됩니다 ㅠㅠ [1] | 2013.02.13 by 리사땅 |
프머000 | 포인트 관련 질문드려요~ [2] | 2013.02.13 by sejin7940 |
도로테비 | 모바일 페이지가 자동으로 리사이징이 안돼요 [3] | 2013.02.13 by drimilda |
XE만세 | 서버 이전시 새로 업데이트된 글/댓글을 옮기려면.. | |
音志 | 회원 이미지 이름 사용에 그룹제한을 걸고 싶습니다. [1] | 2013.02.13 by 송동우 |
BonaSera | 서버 이전 후, 어드민 로긴 안되고, 404에러 뜹니다. [2] | 2013.02.13 by BonaSera |
귀여운유니 | 댓글 정렬 질문입니다. [1] | 2013.02.13 by 송동우 |
꿈틀잉 | sql 제목부분 일괄 수정질문요.. [1] | 2013.02.13 by 송동우 |
uoou | 페이스북 좋아요 버튼 클릭시 확인버튼 생성 문제 | |
괴고 | XE 설치시 오류요... [1] | 2013.02.13 by 푸시아 |
KTK | 송동우님 저번에 답변해주신 문제입니다.. | |
꿈틀잉 | 로그인... 점점점 삭제 [1] | 2013.02.13 by 송동우 |
유유히 | 특정 게시판 리스트를 엑셀파일로 출력 확장변수 까지 같이 출력 할려고 하는데... | |
똘 | 게시판을 삽입하면 테이블이 깨져요..ㅠㅠ [1] | 2013.02.13 by 윤씨 |
최태진814 | 모바일에서 위젯을 수정 할 수 있나요?? [1] | 2013.02.13 by 音志 |
도로테비 | 모바일 수정을 어디서 해야 할지 모르겠어요ㅠ.ㅠ | |
쿠마노미 | `홈페이지 오류질문 |