묻고답하기

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

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 남기남
다랑어 코어 XpressEngine ver. 1.11.2 - 업데이트 실패  
chee**** 다국어 세트 저장이 안됩니다 [2] file 2019.03.14 by chee****
아스키 사용자정의에서 입력폼 위치 변경 [3] file 2019.03.14 by 아스키
허얼윤 게임 전적검색 사이트 제작하려고하는데요. [1] 2019.03.13 by SimpleCode
jjhe**** 도어웹님 레이아웃 [1] file 2019.03.13 by DoorWeb
calko DB로 사이트 복귀하는 방법 [4] 2019.03.13 by calko
생컨38889 간혈적으로 OOPS 창이 나오는데 왜이럴까요?  
럭키걸 html 선택박스 없는데 file  
rail_man 가상서버 신청시 OS는 어느 것을 선택해야 하는지요  
개발자티케 주소입력 url 리다이렉션 질문드립니다!! [2] 2019.03.12 by 개발자티케
시엘 인스톨후 404 오류 문제 [1] 2019.03.12 by 시엘
우주 포인트 선물 모듈 수수료 적용 오류  
hatali 포탈사이트 서브도메인 설정  
남창훈 메인페이지 동영상 autoplay 문제 [3] 2019.03.11 by DoorWeb
한끝 'DB Table 생성과 모듈 업데이트 필요'가 안됩니다. [1] 2019.03.11 by 아찌
아찌 module - DB Table 생성하기 안되는 이유 아시는분 [2] 2019.03.11 by 아찌
kare**** 확장변수 중 전화번호를 가져올 수 있는 방법이 있을까요? [2] 2019.03.11 by kare****
누리누리 미디어 글쓰기 삽입 애드온이 관리자만 됩니다  
chorok 파이어폭스에서 아이프레임 안먹히나요??  
검은내일 서브도메인마다 시작 홈페이지를 따로 지정할 수 있나요? [2] 2019.03.08 by 검은내일
kunh**** 크롬에서 템플릿 섹션내용이 안보여요 file  
알파인웍스 섬네일 db 테이블 위치 [1] 2019.03.08 by sejin7940
homi**** xedition 슬라이드 글자색은 어떻게 바꾸나요? [5] 2019.03.07 by 마하수리
쥬크레이 익스플로러11에서만 마우스호버가 잘 동작하지 않습니다. [5] 2019.03.07 by wtst
chorok XEDITION edited by Kim Tajo 에서 좌측 상단 로고가 [1] 2019.03.07 by chorok
homi**** xe 1.11.2로 올리고 나서 본문에 파일 첨부가 안되요 [1] 2019.03.07 by homi****
-c64ac 팝업창 전체 수정 [4] file 2019.03.07 by -c64ac
하이하이데스 게시판 상단내용 입력시 역슬래쉬 생성 문제 [1] file 2019.03.07 by 마하수리
마하수리 PHP 버전 변경 후 해야 할 일 [2] 2019.03.07 by 마하수리
Masterhwan 홈페이지 스킨을 변경 했습니다 [1] 2019.03.06 by DoorWeb