엑셀로 출력을 하고 싶은데...

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
엑셀로 출력을 하고 싶은데...

QA

엑셀로 출력을 하고 싶은데...

본문


<?
ob_start();
include_once($_SERVER['DOCUMENT_ROOT'] ."/common.php");
 

header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename=view.xls");
 

$is_title="엑셀 문서 다운로드";
 

$sql="select * from g5_member";
$is_print=sql_fetch($sql);
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
<title>수련회등록현황</title>
</head>
<body>
<table>
<tr>
<th scope="col">번호</th>
<th scope="col">이름</th>
<th scope="col">연락처</th>
<th scope="col">지구</th>
<th scope="col">학교</th>
<th scope="col">학번</th>
<th scope="col">선택특강</th>
<th scope="col">등록현황</th>
</tr>
 <?php
        for ($i=0; $i<count($is_print); $i++) {
         ?>
<tr>
<td class='txt'><?=$is_print[$i]['mb_id']?></td>
<td class='txt'><?=$is_print[$i]['mb_name']?></td>
<td class='txt'><?=$is_print[$i]['mb_hp']?></td>
<td class='txt'><?=$is_print[$i]['mb_5']?></td>
<td class='txt'><?=$is_print[$i]['mb_3']?></td>
<td class='txt'><?=$is_print[$i]['mb_4']?></td>
<td class='txt'><?=$is_print[$i]['mb_2']?> / <?=$is_print[$i]['mb_10']?></td>
<td class='txt'><?=$is_print[$i]['mb_1']?></td>
</tr>
<?}?>
</table>
</body>
</html>

 

이렇게 해서 원하는 내용만 따로 엑셀로 뽑을려고 하거든요.

그런데...

 

 <?php        for ($i=0; $i<count($is_print); $i++) {         ?>....<?}?>

이걸 넣어야 리스트들이 주루룩 나오는걸로 알고 있습니다.

그런데... 위 문을 넣으면 아예정보가 나오질 않습니다.

 

넣지 않을때는 정보 하나는 엑셀로 나왔거든요...

뭐가 문제인지 알 수 있을까요? 해결방법이 궁금해요 ㅜㅜ

이 질문에 댓글 쓰기 :

답변 1

$sql="select * from g5_member";
$is_print=sql_fetch($sql);

 

위를

 

$sql="select * from g5_member";
$result=sql_query($sql);

 

로 수정하고

 

for ($i=0; $list = sql_fetch_array($result); $i++) {

 

하면 됩니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 3

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT