묻고답하기

엑셀 출력시 에러메세지가 발생이 되는데 어떻한 부분을 바꿔야 할까요?

3.png

 

<?php

//url 로 직접 불러오는것을 방지

if(!strstr($_SERVER['HTTP_REFERER'],$_SERVER['SERVER_NAME'])&& !strstr($_SERVER['HTTP_REFERER'],'out_excel.php')) exit;

 

$info = array(

"host" => "localhost",

"user" => "root",

"pass" => "autoset",

"db" => "dt",

"table" => "dt_documents",

"module_srl" => "737",

);

$getFields = array("title","regdate","content"); //출력원하는 칼럼을 배열로 입력

 

header("Content-type: application/vnd.ms-excel");

header("Content-Disposition: attachment; filename=doc_".date('Ymd').".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">

</head>

<body>

<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>";

}

 

//확장변수의 타이틀은 값이므로       

$result = mysql_query("select  var_name from xe_document_extra_keys where module_srl = $info[module_srl]");                  

while( $data = mysql_fetch_array($result) )

{                          

    echo "<th>".htmlspecialchars($data[var_name])."</th>";

}  

 

echo"</tr>";             

 

 

//데이터 불러오기

$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) ) 

        {

            if ($key ==  'regdate') { 

                echo "<td   style='mso-number-format:\"0_ \";' >".htmlspecialchars($val)."</td>";               

            }elseif ($key ==  'content'){       //내용 출력할경우 태그가 그대로 출력됨         

                //echo "<td>".$val."</td>";     //셀이 두칸이상으로 늘어남

                echo "<td >".htmlspecialchars(strip_tags(str_replace(" ","",$val)))."</td>";

            }else {

                echo "<td>".htmlspecialchars($val)."</td>";

            }  

        }

 

        if ($key ==  'document_srl'){           //확장변수 불러올때 사용

            $d_srl=$val;

        }

 

    }

                //확장변수 출력 ////////////////////////////////////////////

                //eid리스트를 불러온다

                $query=mysql_query("select eid from xe_document_extra_keys where module_srl = $info[module_srl]");      

                while($extra_title=mysql_fetch_array($query))

                {      

                    echo"<td>";

 

                    $egetFields = array("value","eid");  

                    //확장변수 값을 불러와 eid값이 같은곳에 출력

                    $extra_result = mysql_query("select * from xe_document_extra_vars where document_srl = $d_srl");  

                    while( $edata = mysql_fetch_assoc($extra_result) )

                    {

                        $extra_str="";

                        foreach( $edata as $key => $val ){

                            if( in_array($key, $egetFields) ){                          

                                $extra_str = $val.",".$extra_str;

                            }

                        }

 

                        $extra_arr=explode(",",$extra_str);                                

                        if ($extra_title[eid]==$extra_arr[0]){

 

                            //전화번호값은 "|@|" 를 "-" 로 변경

                            if($extra_title[eid]=="mb_phone_Number"){

                                echo str_replace("|@|","-",htmlspecialchars($extra_arr[1]));

 

                            //기타 배열값들은 ',' 로 변경

                            }elseif($extra_title[eid]=="mb_incomplete"||$extra_title[eid]=="mb_cs"){

                                echo str_replace("|@|",",",htmlspecialchars($extra_arr[1]));

                            }else{

                                echo htmlspecialchars($extra_arr[1]);                     

                            }

                        }

                    }

 

                    echo"</td>";   //eid값이 없으면 빈칸입력

                }              

                /////////////////////////////////////////////////////////////////////

 

    echo"</tr>";

}

 

 

?>

</table>

</body>

</html>

 

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
이와이 통합검색 페이지 레이아웃 관련.. [2] 2018.12.24 by 이와이
변규종 웹호스팅 구매후 xe업로드 완료입니다. [6] 2018.11.26 by 기진곰
LeeMark XE코어 첫 다운로드 이후에 'HTTP ERROR 500' 에러가 납니다. [2] 2018.11.26 by 기진곰
슈햄 애드센스가 마음대로 붙습니다 ㅠㅠ file  
이와이 게시판 사용자정의 필수항목 적용 안됨  
ex**** 게시판 드롭다운메뉴가 안보여요 ㅠ [2] 2018.11.26 by ex****
CtrlV 메뉴 노출 대상 문제 [2] 2018.11.27 by CtrlV
디자인뽀 게시판 본문 내용 글자수 표시 출력 문의  
이기릇 [게시판 카테고리] 전문가님들 도와주세요 [2] 2018.11.27 by 이기릇
이미경 XE를 닷홈무료호스팅에 XE를 설치하였는데 에디트플러스ftp연결이안됩니다. [2] 2018.11.27 by 허허길드짱
wtst 팝업이 메인에 안뜹니다..ㅠ [5] 2018.11.27 by wtst
JeongUk Contact 게시판스킨, 모바일 스킨ver. 1.14 질문입니다. [3] file 2018.11.27 by DoorWeb
쮸야282 첨부와같이 메인화면에서 이름 전화번호를 넣어면 관리자에게 [1] file 2018.11.28 by sejin7940
Wendy.Wang 설치후 메인 접속시 404에러는 왜 이런가요? [1] 2018.11.28 by 도토리묵
이와이 content 위젯 공지사항 [5] 2018.11.28 by 이와이
권만주 모바일 콘텐츠 위젯에 새글 아이콘 [2] 2018.11.28 by 권만주
이와이 통합검색 의 검색 버튼 누르는 부분의 소스가 어디에 있나요?? 도와주세요~~~~~~ [1] 2018.11.28 by DoorWeb
누리 회원정보 이전이 안됩니다. [4] file 2018.11.28 by 누리
rhemrgks12 메인페이지의 게시판링크아이콘 변경방법... [4] file 2018.11.29 by rhemrgks12
rhemrgks12 제로보드 메인홈페이지의 아이콘 변경 [3] file 2018.11.29 by rhemrgks12
지닛 인터넷 쇼핑몰 일본 현지 최적화를 위한 서버 호스팅 문의  
프리즘 게시판내 파일 업로드시 경로설정 [1] 2018.12.01 by 기진곰
아라리 XE 왼쪽 메뉴가 모두 뜨지 않아요. [2] file 2018.12.01 by 아라리
hatali 내용직접추가 오류 [2] file 2018.12.02 by hatali
권만주 쪽지 글쓰기 입력란이 사라졌어요 [1] file 2018.12.03 by 권만주
발꾸락형님 외부페이지와 스크립트 문제 입니다.  
rhemrgks12 슬라이더 이미지내의 버튼 삽입 [1] file 2018.12.04 by DoorWeb
Ru 나이스본인인증모듈 질문 [1] 2018.12.04 by sejin7940
권만주 반응형 갤러리 위젯 없나요?(정보수정 재문의) [2] file 2018.12.04 by 권만주
김곰돌 이미지 슬라이드를 하나만 출력하게 하고 싶습니다..