[ GNUSHOP ] [그누보드] html table xl파일 생성 후 다운로드
작성일 20-03-03 17:38
페이지 정보
작성자최고관리자 조회 405회 댓글 1건본문
<?
header( "Content-type: application/vnd.ms-excel" );
header( "Content-type: application/vnd.ms-excel; charset=utf-8");
header( "Content-Disposition: attachment; filename = exname.xls" );
header( "Content-Description: PHP4 Generated Data" );
include_once('./_common.php');
$page_set = 10; // 한페이지 줄수
$block_set = 5; // 한페이지 블럭수
if($_GET['guxyz']){
$and123="and b_tit='".$_GET['guxyz']."'";
}
$sql = " select count(*) as total from member where b_gubun='edu' $and123";
$row = sql_fetch($sql);
$total = $row[total];
$total_page = ceil ($total / $page_set);
$total_block = ceil ($total_page / $block_set);
if (!$page) $page = 1; // 현재페이지(넘어온값)
$block = ceil ($page / $block_set);
$limit_idx = ($page - 1) * $page_set;
$num001=$total-($page-1)*$page_set;
$sql = "select * from member where b_gubun='edu' $and123 order by b_idx desc";
$result = sql_query($sql);
// 테이블 상단 만들기
$EXCEL_STR = "
<table border='1'>
<tr>
<td>번호</td>
<td>성명</td>
<td>성별</td>
</tr>";
for ($i=0; $row=sql_fetch_array($result); $i++) {
$EXCEL_STR .= " <tr>
<td>".$num001."</td>
<td>".$row['name']."</td> ";
$EXCEL_STR .= "<td>여자</td>";
$EXCEL_STR .= "
</tr>
";
$num001--;
}
$EXCEL_STR .= "</table>";
echo "<meta content=\"application/vnd.ms-excel; charset=UTF-8\" name=\"Content-type\"> ";
echo $EXCEL_STR;
?>
댓글목록
무늬만생각님의 댓글
무늬만생각 작성일
* 포인트
header( "Content-type: application/vnd.ms-excel" );
header( "Content-type: application/vnd.ms-excel; charset=utf-8");
header( "Content-Disposition: attachment; filename = exname.xls" );
header( "Content-Description: PHP4 Generated Data" );
echo "<meta content=\"application/vnd.ms-excel; charset=UTF-8\" name=\"Content-type\"> ";
echo $EXCEL_STR;