채택완료

DB 엑셀로 내려받으려고 합니다.

2016-07-25 (월) 12:12:11 4,633

phpmyadmin 에서

g5_fmail 라는 테이블의 DB를 엑셀파일로 받아보려고합니다. 

그누보드 관리자 페이지에서 엑셀 받아보는게 있긴한데 눌러서 다운을 받으면 내용이 하나도 안나오네요 ㅠㅠ

Copy
<?$sub_menu = "600100";include_once("./_common.php");auth_check($auth[$sub_menu], "r");$sql_common = " FROM g5_fmail WHERE 1 ";if ($sfl && $stx) $sql_common .= " AND INSTR(`".$sfl."`, '".$stx."') ";$sql="SELECT * ".$sql_common." ORDER BY seq desc ";$result = sql_query($sql);$printStr = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html>\n<head>\n<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">\n<meta name=ProgId content=Excel.Sheet>\n<style id=\"Classeur1_16681_Styles\">\n TD{border-color:silver;mso-number-format:General;}\n</style>\n </head>\n\n<body>\n<div id=\"Classeur1_16681\" align=center x:publishsource=\"Excel\">\n<table x:str border=1 cellpadding=0 cellspacing=0 width=100% style=\"border-collapse:collapse;border-color:silver\">\n";$printStr .= "<tr>\n<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">번호</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">이름</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">연락처</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">생년월일</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">기대출</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">희망금액</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">대출상품</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">상태</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">아이피</th>";$printStr .= "<th nowrap style=\"background:lightcyan;color:navy;text-align:center;font-weight:bold;\">접수일</th>";$printStr .= "</tr>\n";$i = 1;while($row = mysql_fetch_array($result)){	$printStr .= "		<tr>\n			<td style=\"mso-number-format:'\#\,\#\#0';text-align:right\" nowrap>".$i."</td>\n			<td style=\"text-align:center\" nowrap>".$row['name']."</td>\n			<td style=\"text-align:center\" nowrap>".$row['tel']."</td>\n			<td style=\"text-align:center\" nowrap>".($row['birth']!='0000-00-00' ? $row['birth']:'&nbsp;')."</td>\n			<td style=\"text-align:center\" nowrap>".$row['loan_use']."</td>\n			<td style=\"text-align:center\" nowrap>".($row['amt']>0 ? number_format($row['amt']).'만원':null)."</td>\n			<td style=\"text-align:center\" nowrap>".$row['flag']."</td>\n			<td style=\"text-align:center\" nowrap>".$row['sts']."</td>\n			<td style=\"text-align:center\" nowrap>".$row['ip']."</td>\n			<td style=\"mso-number-format:'Short Date';text-align:center\" nowrap>".substr($row['w_dt'],0,10)."</td>\n		</tr>\n	";	$i++;}$printStr .= "</table>\n</div>\n</body>\n</html>\n";$filename = "온라인문의_".date("Y_m_d").".xls";$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);$filename = iconv("UTF-8", "EUC-KR", $filename);header("Content-type: application/vnd.ms-excel;charset=utf-8");header("Content-Length: ".strlen($printStr)); header("Content-Disposition: attachment; filename=".$filename);header("Content-Description: PHP4 Generated Data" );header("Content-Transfer-Encoding: text/plain");header("Cache-Control: must-revalidate, post-check=0,pre-check=0");header("Pragma: no-cache");header("Expires: 0");exit($printStr);?>
 


이렇게 양식이 있는데 엑셀로 내려받으면 내용은 아무것도 안보이네요... 경로가 잘못된건지

아니면 다른게 문제인지 모르겠습니다. 도와주세요 ㅠ

|

답변 3개 / 댓글 3개

채택된 답변
+20 포인트
2016-07-25 (월) 12:25:19

48번부터 58번까지를 가장 4번 줄에 넣어서 실행해 보세요. 

답변에 대한 댓글 1개

4번쨰 줄로 옮겨봤는데 똑같네요 그래두 답변달아주셔서 감샇바니다.

서버 업체에서 당연이 해주는거고 해주는 시간도 10분도 안걸리는 일입니다

답변에 대한 댓글 1개

자체 호스팅하고있어서 맡겨서 하는 업체가 따로없네요 ㅠ 답변달아주셔서 감사합니다.

걍 왠만 한  서버 업체라면  전하 한통 화하면 해줍니다

답변에 대한 댓글 1개

대표가 돈 들어간다고 저보고 찾아보라고해서요...

답변을 작성하려면 로그인이 필요합니다.